W3C home > Mailing lists > Public > public-xml-id@w3.org > February 2005

Re: Multiple ID attributes on a single element

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Mon, 07 Feb 2005 14:03:20 -0500
To: Anne van Kesteren <fora@annevankesteren.nl>
Cc: veillard@redhat.com, public-xml-id@w3.org
Message-id: <87u0oo42h3.fsf@nwalsh.com>
/ Anne van Kesteren <fora@annevankesteren.nl> was heard to say:
|>> Although I am too late for last call comments I was wondering if
|>> the WG could clarify which ID attribute should get presedence when
|>> multiple are applied to a single element.
|> Could you explain what you mean by "presedence" there ?
| # <p xmlns="http://www.w3.org/1999/xhtml" id="foo" xml:id="bar"/>
| Which ID attribute is considered to be the ID attribute of the
| element? (What is the value of the ID attribute of this element when
| I request it.) Or can a well-formed XML document have multiple ID
| attributes per element albeit invalid XML?

The value of the ID attribute when you request it is going to depend
on which one you request :-). You can't have a schema (small 's') that
defines both id and xml:id as having type ID. I think there are several
cases to consider:

1. There's no schema. In that case, the ID of this element is 'bar'
   because 'id' is not an ID.

2. There's a schema that defines xml:id as an ID. In that case, the ID
   of this element is 'bar' because 'id' is not an ID.

3. There's a schema that defines id as an ID (but does not declare
   xml:id). In that case, the ID of this element is...both foo and bar
   is the best answer I can give.

4. There's no schema, but the application gives attributes named id
   special significance anyway. In that case, the ID of this element
   is...both foo and bar is the best answer I can give.

In both case 3 and case 4, the application still has some freedom to
decide what the right answer is. In resolving other last call
comments, we've explicitly made the point that xml:id is about
determing what things are IDs, not about saying what applications do
with them or how they might additionally be constrained.

With respect to having multiple ID values on a single element, it's
already possible in W3C XML Schema (because XSD allows both attributes
and elements to have the type 'ID' and makes no prohibition against
multiple elements of type ID or against an element having both an
attribute and a child of type ID).

On a more philosophical level, I have never found anyone who could
provide a good reason why the prohibition against multiple ID
attributes exists in SGML. (It exists in XML only because it existed
in SGML.)

I hope that xml:id doesn't introduce a whole slew of nasty issues
around elements with multiple ids. I hope, instead, that the world
will migrate towards using xml:id exclusively. Certainly in
applications that require validity, the presence of both id and xml:id
can be prevented.

                                        Be seeing you,

Norman.Walsh@Sun.COM / XML Standards Architect / Sun Microsystems, Inc.
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

Received on Monday, 7 February 2005 19:03:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:53:49 UTC