commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "simon.kitching@chello.at" <simon.kitch...@chello.at>
Subject Re: Digester - DynamicDigester?
Date Mon, 31 Mar 2008 09:31:54 GMT
tim robertson schrieb:
> Hi,
> I would like to configure some form of DynamicDigester to parse generic XML
> that contains repeatable content into a List of Map.
> Each repeating element means a new map, and the map is keyed on the pattern,
> with the value being the digesting value.
>
> So considering:
>
> ...
> <record>
>   <name>Tim</name>
>   <age>21</age>
> </record>
> <record>
>   <name>Tom</name>
>   <age>22</age>
> </record>
> ...
>
> I would like to configure it with patterns "*/name" and "*/age" and also
> with the pattern for the repeating element "*/record".
>
> Then after digesting I would like a
> List<Map<String, String>>
>
> representing:
> [name:Tim][age:21]
> [name:Tom][age:22]
>
> Can anyone help me with this?
>
> Be aware that I want to digest different XML schemas with the same Digester,
> but just register different patterns for the "items of interest" and the
> marker for the repeating element.
>
> So really, I am thinking a pattern to push onto the stack a new HashMap for
> each repeat element, and then register patterns to put the Pattern as the
> key and the result as the value.
>
> Unfortunately I can't work out how to get the Pattern in a Rule firing...
>
> Thanks for any help or advice!
>   
Have you looked at the digester examples that are included in the source
download, or that can be accessed directly here?
 
http://svn.apache.org/repos/asf/commons/proper/digester/trunk/src/examples/

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message