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

From: Daniel Aleksandersen <[email-masked]>
Date: Wed, 30 Jan 2008 22:40:53 +0100

Hi emailing list, (message contains Unicode characters)
 
Why does Atom use a special id element for identification instead of 
relying on the xml:id attribute? Currently, I apply an identical value to 
both.

<feed … xml:id="urn:uuid:1">
  <id>urn:uuid:1</id>
  <entry xml:id="urn:uuid:2">
    <id>urn:uuid:2</id>
  </entry>
</feed>

The xml:id attribute makes parsing easier in a lot of environments—
especially in PHP 5 DOM XML—, but since the Atom format requires an id 
element; I have to include that as well. What decision lead to the 
inclusion of the required atom:id element instead of the xml:id? Is there 
a point I am missing somewhere?

xml:id is perfectly capable of performing the task of atom:id. I cannot 
see why there would be any need for any special id element in any XML 
format when we have got xml:id.
-- 
Daniel Aleksandersen <[email-masked]>

---

From: Joe Cheng <[email-masked]>
Date: Wed, 30 Jan 2008 15:30:36 -0800

From http://www.w3.org/TR/xml-id/

"""An xml:id processor must assure that the following constraints
hold for all xml:id attributes:

The normalized value of the attribute is an NCName according
to the Namespaces in XML Recommendation which has the same
version as the document in which this attribute occurs (NCName
for XML 1.0, or NCName for XML 1.1)."""

Doesn't this mean you can't use a URI as an ID?

---

From: Daniel Aleksandersen <[email-masked]>
Date: Thu, 31 Jan 2008 00:35:39 +0100

> Doesn't this mean you can't use a URI as an ID?

No, not from what I can tell. An ID must be unique within the document. 
Regarding naming it must start with a letter or an underscore. Other than 
that, there is nothing indicating that it cannot be an IRI.

> From: [email-masked]
> [mailto:[email-masked]] On Behalf Of Daniel
> Aleksandersen Sent: Wednesday, January 30, 2008 1:41 PM
> To: Atom emailing list
> relying on the xml:id attribute? Currently, I apply an identical value
> to both.
>
> inclusion of the required atom:id element instead of the xml:id? Is
> there a point I am missing somewhere?
>

---

From: Joe Cheng <[email-masked]>
Date: Wed, 30 Jan 2008 15:44:44 -0800

> Other than that, there is nothing indicating that it
> cannot be an IRI.

If it has to be NCName then it can't contain a colon. Am
I wrong in concluding that it has to be NCName?

---

From: Daniel Aleksandersen <[email-masked]>
Date: Thu, 31 Jan 2008 00:47:41 +0100

> I wrong in concluding that it has to be NCName?

Actually, you are quite right. It must be a NCName, and that does leave 
out colon. I have never read that part of the specification that 
carefully. Comming to think about it, I knew it could not contain a colon 
from my previous works with CSS and ID attributes in XHTML.

But my question on why the atom:id element is being used instead of the 
xml:id attribute still stands.
-- 
Daniel Aleksandersen <[email-masked]>

---

From: Joe Cheng <[email-masked]>
Date: Wed, 30 Jan 2008 16:31:17 -0800

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

But... atom:id has to contain an IRI.
http://tools.ietf.org/html/rfc4287#section-4.2.6

---

From: "David Nesting" <[email-masked]>
Date: Wed, 30 Jan 2008 16:40:51 -0800

> xml:id attribute still stands.

It is desirable for the identifier to be an IRI.  You can ensure global
uniqueness this way and your identifiers can be structured, readable, and
possibly participate in existing identifiers used on your web site (such as
the entry's permanent URL).  While you might be able to adopt additional
constraints to apply to xml:id attributes to achieve the same goals, this
would be awkward given xml:id's restrictions, potentially confusing since
you're effectively overloading the semantics of xml:id, and potentially
painful if someone attempts to create or embed an xml:id obeying XML's rules
but violating Atom's rules.  Not all XML within an Atom document will be
Atom.

David