I am creating Java DTO from Xml string, But the sequence of fields are not the same. For example Xml String:
<student>
<name>Beff</name>
<surname>Jezos</surname>
<age>18</age>
</student>
Converted Dto is like:
<student>
<surname>Jezos</surname>
<age>18</age>
<name>Beff</name>
</student>
Is there some annotation like this that lets us to put numbers of fields like:
public class Student {
@XmlFieldSequence(place = 1)
public String name;
@XmlFieldSequence(place = 2)
public String surName;
@XmlFieldSequence(place = 3)
public int age;
}
CodePudding user response:
I found this annotation from javax.xml.bind.annotation.XmlType;
@XmlType(propOrder = {"name","surname","age"})
public class Student{
public String name;
public String surName;
public int age;
}