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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] IDs considered harmful or why keys might be better than IDs...

On Monday 12 November 2001 11:34 pm, Jonathan Borden wrote:
> Perhaps I am missing your point. By 'they' are you refering to "ID"s or
> something else. When I refer to an XML ID I am refering to a concept that
> is defined in XML 1.0 (and before that SGML of course) and refered to in
> XPath where the id('foo') function refers to an _element_ which has an ID
> attribute ='foo', similarly the DOM function getElementById('foo')
> Now surely how this element is used, and what it 'means' is dependent on
> application level semantics, but the element has a _name_ according to how
> I use XML. By this convention, which is consistent across not only my own
> thinking but XPath and DOM L2, an XML ID is a way to name an element so
> that it may be retrieved via an API.
> What do you mean by 'they always depend on application semantics."?

Well, to me (and I've been around the block a few times ;-)) ID's are 
*attributes* declared to be of type ID. These attributes, in valid documents, 
are constrained to have unique values within the scope of a document. Beyond 
that, the declaration does nothing, and so, the *interpretation* of 
these (and indeed, all markup), is in the hands of the application.

If you look at DOM getElementById() and id() in XSLT, they are defining the 
semantics of elements with ID attributes *in the context of a given 

I can honestly say that I find ID attributes to be of little value. In the 
(more years than I care to remember) that I have used SGML and XML, I have 
not once (seriously NEVER) used the ID-ness for anything other than 
validation... and that was only because SGML provided no way other than ID to 
guarantee that the attribute values were unique. At the application level 
(validation generally occured before the data is deployed) being able to 
count on unique values (and even then, scoped by markup or other application 
conventions) is all that ever mattered... and I've built a *lot* of 

I may be unusual in my experience, but my gut tells me that there are a whole 
lot of people out there just like me (please correct me if I'm wrong). 

I can see *some* value in supporting #foo, but I really don't think it's 
worth kludges. If we *have* to keep it, I'd be inclined to go with either 
xml:name or xml:idatts, but I'd rather just see #foo bagged. It'd simplify 
XPointer grammar a bit anyway ;-)