Is it possible to tell JAXB to ignore the order of elements? So that the generate XSD will contain all
-elements instead of sequence
-elements?
Add an XmlType
annotation to the class with an empty propOrder
, like this:
@XmlType(propOrder={})
public class MyClass{
String username;
String street;
String address;
}
It will then generate an xs:all
(which is unordered) instead of a sequence.
<xs:complexType name="MyClass">
<xs:all>
<xs:element name="username" type="xs:string" minOccurs="0"/>
<xs:element name="street" type="xs:string" minOccurs="0"/>
<xs:element name="address" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With