[Simple-support] ElementMap with unknown child elements
Brought to you by:
niallg
|
From: Alex B. <ale...@ou...> - 2013-03-12 14:56:20
|
Hey All,
Given the XML :<Parent>
<Child1>Value1</Child1><Child2>Value2</Child2><Child3>Value3</Child3></Parent>
How would I serialize / deserialize so that I have a Java Object like below. I don't know the name of the child elements, I just want to get key-value pairs from the children, with key being the element name, and value being the text element inside the xml.
class Parent{public HashMap<String,String> children;}
I have tried multiple different combinations of ElementMap and ElementList but couldn't seem to get it to work the way I wanted.
Thanks in advance,
Alex Boyd |