Re: xml:id versus xmlid

Norman Walsh wrote:

> This is simply misleading. The name xml:id requires no additional
> complexity over the name xmlid. By analogy, the concept of an
> element's natural language or the significance of whitespace in the
> element "is so basic and fundamental that it should be usable by
> everybody" and *it is* with attributes named xml:lang and xml:space.
>

On the implementer side, I have worked on the issue of xml: attributes 
in three separate systems: JDOM, XOM, and Jaxen. It was a noticeable 
hassle in all three. Both JDOM and Jaxen got this wrong before I stepped 
in. XOM is probably the strictest of the three, and it has to do quite a 
bit of extra work to guarantee no one mismaps the xml prefix or 
namespace URI. Based on experience, I have no doubt I could find quite a 
few other shipping pieces of XML software that mishandle the xml prefix 
in one way or another. If I were to make the effort to compile such a 
list, would this convince you?

As a user, it is almost always easier to use an unqualified name than a 
prefixed name. For xmlid, I simply need to say something like

element.getAttributeValue("xmlid");

For xml:id, by contrast, one must say something like:

element.getAttributeValue("id", "http://www.w3.org/1998/XML/namespace");

Frankly, I have to look up that string in Google every time I use it. 
With autocomplete in Eclipse, it's a little easier to type

element.getAttributeValue("id", Namespace.XML_Namespace);

but it's still more complex that simply asking for the attribute named 
xmlid. XPath is even trickier because you have to set up the namespace 
prefix bindings in a different scope (or not, details vary from one 
engine to the next.)

xml:lang, xml:space, and xml:base have caused real difficulties for real 
users, including me. The difficulties are not insurmountable, but 
they're still painful. Most importantly, any causal developer who is not 
a full time XML wonk like we are will get this right. if we can make it 
simpler, we should make it simpler. xmlid is about as simple as we can 
make it.

-- 
Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

Received on Tuesday, 26 April 2005 01:05:22 UTC