You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by tim robertson <ti...@gmail.com> on 2008/03/30 21:39:37 UTC

Digester - DynamicDigester?

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!

Tim