I would like to ask on how to marshal an object with property order from a nested object.
@XmlRootElement(name = "sample")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = {"title", "code"})
public class SampleObject {
@XmlAttribute(name = "title")
private String title;
@XmlAttribute(name = "code")
private String code;
}
I have a wrapperList to set that object:
@XmlRootElement(name = "listWrapper")
@XmlAccessorType(XmlAccessType.FIELD)
public class WrapperObject {
@XmlAnyElement(lax=true)
private List<SampleObject> objectList;
}
And i want to set the list on this object. This object is the one who is being marshalled.
@XmlRootElement(name = "marshaller")
@XmlAccessorType(XmlAccessType.FIELD)
public class MarshallerObject {
@XmlElement(name = "wrapperList")
private WrapperObject objectList;
}
This is the output that i'm aiming for:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<marshaller>
<wrapperList>
<sample title="sampleTitle code"001"/>
</wrapperList>
</marshaller>
</soap:Envelope>
Thanks in advance!