From purely an XML validity point of view, it depends on the schema, if any, that describes what the rules are for formatting the XML.
That said, order must be preserved (see 2.1.1 in http://www.w3.org/TR/xml-infoset/) but whether it's "important" to an application is up to its author.
Within a schema, order can be made unimportant with the use of the xs:all
compositor, though I'm not sure that this impacts the preservation of captured order, i.e. I'd still expect the order at origin/serialization to be maintained by XML processors.
However, in 1.0 this compositor adds a restriction on the child elements so that they must occur 0 or 1 times. In XSD 1.1, this restriction is removed, making it easier to contractually specify that order is not important, effectively xs:all
has become the unordered version of xs:sequence
.
Because of the overly-restrictive 1.0 xs:all
compositor, the ordered xs:sequence
compositor had to be used. Thus, order was often artificially imposed.
Adoption of 1.1 by vendors of validator libraries is slow.
As such, APIs need to consider order when being evolved with new elements. I am not aware of any XML serialization framework that can work with 1.1 and you have to assume your clients will be using 1.0 and will validate the 1.1 incoming messages with 1.0 rules and choke.
Luke