Re: Attribute Order (Was: Create XML )
From: "Elliotte Rusty Harold" <elharo@m...> > What contexts? How would having attribute order preserved help you? > Even in the context of an XML editor I can't say that preserving > attribute order is all that important. People get upset when editors > screw with their entities. I don't remember anyone getting too peeved > because an editor shuffled their attributes. It is fairly common usage to have a single attribute that acts as a discriminator or label for an element. For example, in Ant, the name attribute of the target element. Humans almost always write this attribute first, as it helps them locate the particular target in the text and is arguably the "most important" attribute, as it is referred to in the depends attributes that determine the partial order in which targets are invoked. People who argue here that namespaces can be replaced by simple attribute conventions should relate to the notion that human beings will probably write first the attribute that tells them what the element name "means". In document designs where attributes are used in this way, for example in the Eclipse "manifest" file, where the point attribute of the extension element determines what other attributes and what element content may appear, it is very common to see the point attribute written first. It is very disconcerting to people when attributes in this kind of document are re-ordered by some process. As the author of an XML editor, I have some first-hand (no pun intended) experience. Like many such editors, mine displays an up-to-date tree representation of the elements in a document. Many users complained that the tree wasn't useful for documents that had many elements with the same name (but OTOH becomes unwieldy if it displays the attributes and text). Some suggested they be allowed to configure that the content of a particular attribute appear in the outline beside the element name, but this would require an awkward per-namespace, per-element configuration process. As an experiment, I simply implemented (as an option) displaying the contents of the _first_ attribute. That seems to have satisfied the requirement, or at least stopped the wheel squeaking; I don't even hear complaints about the information showing up when it has no particular significance. These examples lead me to the opinion that attribute order matters when documents are authored or read by humans. The "if order matters, use elements" argument leaves me completely cold. This is how real people design and use documents. That's why they call 'em use cases. Bob Foster
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format