Convert Xml to Java Bean - Problems with Map and Tags attributes



I've a very tricky problem. I'm not able to convert a piece of XML document in a corresponding structure of java beans. My problems are related to tags attributes and map "key/value" attributes. Look at this piece :



<java>
<field name="stepName">
<string value="inject-attribute-step"/>
</field>
<field name="params">
<map>
<entry>
<key>
<string value="value"/>
</key>
<value>
<string value="4"/>
</value>
</entry>
<entry>
<key>
<string value="variable"/>
</key>
<value>
<string value="progress_bar_status_desc"/>
</value>
</entry>
</map>
</field>


I suppose that i've to create a bean "JAVA" as xml root. But the problem is related to the "Field" class, that appears to have differents implementation (how can rappresent this structure ?). However a big problem is in the rappresentation of 'map' tag , explaining an hashmap that does not have single value for elements 'key' and 'value' , but has another tag instead ('string value=" ......"/'). I've read a lot of answers about marshalling and unmarshalling but there'is only simple xmls, i need something more complex (maybe with type adapters ?? ).Please someone help me ! (and sorry for my horrible english :( )


No comments:

Post a Comment