OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Attribute Order (Was: Create XML )

[ Lists Home | Date Index | Thread Index ]

From: "Elliotte Rusty Harold" <elharo@metalab.unc.edu>
> 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







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS