Digester - DynamicDigester?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digester - DynamicDigester?

timrobertson100
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