JAXB unmarshalling, element guarantee order
I am parsing a sequence of elements with JAXB in a list, see below.
from XML file
<stroke>
<textPoint x="81.0" y="457.0" p="0.0" e="90.0" a="0.0" />
<textPoint x="80.0" y="457.0" p="0.0" e="89.0" a="135.0" />
<textPoint x="81.0" y="455.0" p="0.0" e="86.0" a="135.0" />
....
<textPoint x="228.0" y="475.0" p="0.0" e="57.0" a="122.0" />
<textPoint x="213.0" y="456.0" p="0.0" e="57.0" a="121.0" />
<textPoint x="233.0" y="476.0" p="0.0" e="57.0" a="122.0" />
</stroke>
Java code
private List<TextPoint> textPointList;
@XmlElement(name = "textPoint")
public List<TextPoint> getTextPointList() {
return textPointList;
}
public void setTextPointList(List<TextPoint> textPointList) {
this.textPointList = textPointList;
}
However, I am a bit worried about the inline order of the textPoint elements as they are ordered in the XML file, but there is no element (like ID) I could sort them through propOrder
. However, they seem to debug them fine in the same order as in the XML file, so there is no need to worry about that?
+3
source to share