Hello,
There is a idea that JAXB does not provide ordering guarantees of
child elements. I've had colleagues assert this, and I see it in
discussions like
http://forums.sun.com/thread.jspa?forumID=34&threadID=622325 . I
haven't found an example that actually demonstrates that ordering at
either marshalling or unmarshalling is unreliable.
I would like to be able to refer to the JAXB 2 Spec on what, if
anything, is promised about the ordering of elements.
From reading exactly The JavaTM Architecture for XML Binding (JAXB)
2.1 Final Release December 11, 2006, I believe:
1. @XmlType's propOrder property can be used to specify the order of
properties: if my schema defines a sequence of three different
elements, I expect xjc to list three corresonding properties in the
same order in the corresponding @XmlType annotation.
2. Appendix B "Runtime Processing", section 3 "Unmarshalling",
sub-section 3.4 "Element Information Item", directs that an element
information item whose .property is a collection type, shall be added
to the end of the collection. This promises that, at least when the
XML instance is schema-valid, document order and the order of items in
the collection will be the same.
I am unable to identify statements similar to #2 for Marshalling. B.4
"Marshalling" does not speak about collection types, or at least not
that I understand. What I am looking for is a statement such as:
The order of objects in the collection is the order in which they
will be marshalled.
Does such a statement, or anything related to it, exist? Is this so
obvious I've missed it?
cheers,
Nigel Kerr