[XOM-interest] attribute ordering

Elliotte Harold elharo at metalab.unc.edu
Mon Jan 22 07:26:41 EST 2007

Steve Loughran wrote:
> simple question: when I enum attributes of a Xom element, does it come
> in any fixed order? And if so, is the order formalised and stable, or
> some implementation detail that may change over time?

Attribute order is not defined, stable, or reliable. It is also not part 
of the XML infoset. Attribute order in XOM  is probably related to the 
attribute order reported by the underlying SAX parser, but I don't 
promise that; and the SAX order is itself not defined, stable, or reliable.

Once you've parsed an element, XOM will not change the order of its 
attributes. Attribute 3 of element X is still attribute 3 of element X 5 
minutes later. However, if you reparse the same document a second time 
that attribute may now become attribute 2 or 4.

Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!

More information about the XOM-interest mailing list