Skip to main content

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

1 reply [Last post]
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

Is that the expected behavior ?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
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.