I am quite sure, this is one of the many duplicated questions around XML to Java Object conversions. But I started this thread since I couldn't find simpler or looking for simpler solution.
I have an xsd [Infact I am designing it] and xml. I would like to auto-map the xml data to Java beans as per mapping
<tns:SummaryCart xmlns:tns="SummaryCart" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="SummaryCart.xsd">
<SummaryElement type="test">
<order>1</order>
<id>A</id>
<displayName>A</displayName>
<subElements>
<order>1</order>
<id>Preactivation</id>
<displayName>Preactivation</displayName>
</subElements>
<maxlines>1</maxlines>
</SummaryElement>
</tns:SummaryCart>
Now my Java classes will be
public class SummaryCart{
private List<SummaryElement> summaryElementList;
}
public class SummaryElement {
private int order;
private String id;
private String displayName;
private String property;
private List<SummaryElement> subElements;
private int maxlines;
private String type;
}
Is there any simple tool/framework which can auto-map the data from XML to Java beans [MUST support attributes/element mapping]. Tutorial will be good.
Btw, I am using Spring framework, if spring-oxm advantage is taken, its welcome.