Skip to main content

Should order of elements match exactly the order in the xsd ?

1 reply [Last post]
amarkel
Offline
Joined: 2004-05-13

I am observing that the only xml documents that pass
validation are those in which the element order matches
exactly the order of their declaration in the generated
xsd.

Is that the expected behavior ?

Arieh

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09

"validation" is an act of checking a document against a schema. If a schema requires things to be a certain order, then validation makes sure that a document follows it. So that's the expected behavior.

I think your question is really about whether JAXB should be generating a schema that requires elements to be in a particular order, and the answer is that we pretty much have to, due to the shortcomings in XML Schema.