Given this schema fragment
<xs:element name="local-tx-datasource">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded"
ref="user-name"/>
<xs:element minOccurs="0" maxOccurs="unbounded"
ref="password"/>
<xs:element minOccurs="0" ref="idle-timeout-minutes"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I realized that JAXB can unmarshal the following XML fragment, where
<password> and <user-name> are out of order and then magically correct
the order during marshalling:
<local-tx-datasource>
<password></password>
<user-name>sa</user-name>
</local-tx-datasource>
Well, I know, I know, it is probably a bug but what a great side effect
if you don't need validation during unmarshalling :-)
By the way, the magic (or bug) happens when you add
'maxOccurs="unbounded"' to the elements.
Han Ming