问题
I am using EclipseLink Moxy as my JAXB provider and presently facing issues in getting the XML marshalled in an expected fashion.
I presently have an object which is having multiple objects.
Object 1 having
@XmlElement(name="Section")
Object2
@XmlElement(name="Section")
Object3
I want to get the XML rendered as:
<Object1>
<Section>
<Object2>...
</Section>
<Section>
</Object3>...
</Section>
</Object1>
I am using Moxy but I am not able to get the desired result. I tried creating a list of objects
@XmlElement(name="Section")
List<Object> sectionsList = new Array<Object>();
but this gives me the object path and not the expected XML. Can someone please help ?
来源:https://stackoverflow.com/questions/39526938/how-to-have-multiple-sections-with-the-same-name-in-jaxb