Subject: RE: atom:id element vs. xml:id attribute

From: "Brian Smith" <[email-masked]>
Date: Wed, 30 Jan 2008 17:38:17 -0800

Daniel wrote:
> But my question on why the atom:id element is being used instead of 
> the xml:id attribute still stands.

* xml:id is only expected to be locally unique. The intention of atom:id is to be globally unique. If you think about the aggregation and syndication model of Atom, then the desire to have globally-unique identifiers becomes clear. The de-facto standard for globally unique identifiers is to use IRIs or UUIDs, and so I guess IRIs were chosen as they are more general (UUIDs can be represented with IRIs). Since xml:id can't hold an IRI or even a URI, xml:id could not be used. (Unfortunately, because there is no way to ensure that atom:ids are globally unique, applications generally have to treat them as though they are locally unique, unless they do a lot of extra work to verify the origin of an entry.)

* If you adhere to the xml:id recommendation, then the value of every xml:id attribute in a document has to be unique within that document. That requirement makes it difficult to mix fragments from different documents together into the same document. Because Atom doesn't require Atom processors to adhere to the xml:id recommendation, this issue doesn't arise with Atom feeds.

* If you use xml:id as an XML ID in a feed document, then you can construct a URI that uses a fragment identifier to refer to the entry within the document. However, this is at odds with the paging and archiving model that is used by Atom. An entry might be at http://example.org/latest.atom#entry-id today, and http://example.org/january-2008.atom#entry-id next week. You can't use redirects based on fragment identifiers. And in fact, http://example.org/latest.atom#entry-id might point to a completely different entry (different atom:id) next week than it does today, and still be compliant with the xml:id recommendation (another motivation for #1 above). By not having an XML ID attributes in Atom, the whole issue of referring to entries in a feed using fragment identifiers is avoided.

If you really want to refer to an entry with a particular ID that can be found at a particular (paged) collection, then you need to reference it using some not-yet-invented "atom:" IRI scheme (e.g. atom:http://exampel.org/blog.feed:http://example.org/blog/maybe-you-should-use-this-IRI-instead.entry).

* The xml:id specification conflicts with the XML 1.0 recommendation. These conflicts have made xml:id very controversial and it seems nobody is really using it for anything. Effectively, it is DOA. 

- Brian