Michael Allman wrote: > On Tue, 27 Jul 2010, Greg Brown wrote: > >>> Call me naive or maybe just a newb but I didn't know that the order in >>> which attributes appear on an element in bxml >>> mattered. I mean, in XML >>> >>> <element attr1="d24" attr2="hahth"/> >>> >>> and >>> >>> <element attr2="hahth" attr1="d24"/> >>> >>> are the same when considering each document's infoset. >> >> That may be true, but in the DOM order has relevance. Attributes are stored >> as a list, not a map. Pivot's >> org.apache.pivot.xml.Element class provides both keyed and indexed access to >> attributes. > > Huh? What language/implementation of the DOM are you referencing? I'm > looking at Java's org.w3c.dom.Node, in which > an element's attributes are represented by a org.w3c.dom.NamedNodeMap. The > documentation for the latter explicitly > states that NamedNodeMap does not imply an ordering. > > Anyway, a list is a map. Or to put it another way, any collection can be > represented by a list simply by enumerating > the elements of that collection in some way. That does not imply that that > collection has some kind of innate or > natural ordering.
Michael is correct here: http://www.w3.org/TR/REC-xml/#sec-starttags Not sure that there is much we can do about it, unless we add some more intelligence to the serialiser, so it knows what order to apply attributes to beans. -- Noel
