I have this schema:
<xs:complexType name="foo">
<xs:sequence>
<xs:element name="oneBar" type="xs:string" minOccurs="0"/>
<xs:element name="twoBar" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
When I try to unmarshal this
<foo>
<oneBar>1</oneBar>
<twoBar>2</twoBar>
</foo>
it works but when I try to unmarshal this xml:
<foo>
<twoBar>2</twoBar>
<oneBar>1</oneBar>
</foo>
I get an excelption because it cares about the order If I try to unmarshal the same xml without using a schema it works in both cases Any ideas?
As Strawberry pointed out if you replace the xs:sequence with sc:any order wont matter, does any of you know what annotation I need to put in my class so it will generate the xs:any schmea
Found solution by creating the class from the xs:any schema You just need to annotate your class with XmlType and set the prop order to be nothing, see:
@XmlRootElement
@XmlType(name="foo",propOrder={})
public class Foo {
@XmlElement
public String oneBar;
@XmlElement
public String twoBar;
}