How to Specify an Order for Properties/Fields
By default, the generated XML Schema for a bean require XML elements to have the same order that you defined your properties and fields in (using xs:sequence). Often this is not a good idea, because after refactoring the Java code may create a XML Schema incompatible with the old one. Therefore a specific order can be defined with the propOrder parameter of the @XmlType annotation:
@XmlType(propOrder={"title", "releaseYear"})
public class Movie {
public int releaseYear;
public String title;
}
If you do not care about the element order at all, you can also specify an empty propOrder sequence. The generated XML Schema will then use xs:all instead of xs:sequence, meaning that the XML elements can appear in any order. But note that the resulting schema may be more difficult to read, for humans as well as computers:
@XmlType(propOrder={})
public class Movie {
public int releaseYear;
public String title;
}

