W3C home > Mailing lists > Public > www-tag@w3.org > January 2003

Re: Options for dealing with IDs

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 10 Jan 2003 17:17:19 +0000
Message-ID: <9828748798.20030110171719@jenitennison.com>
To: Chris Lilley <chris@w3.org>
CC: www-tag@w3.org

Hi Chris,

> JT>   <foo xml:idAttr="id">
> JT>     <bar id="fred" />
> JT>     <baz xml:idAttr="ID" ID="barney" />
> JT>   </foo>
>
> JT> As I understand it, if <baz> had an id attribute then that would also
> JT> be counted as an ID. Is that correct, or is your intention that there
> JT> is only ever be one attribute in scope as an ID attribute at any one
> JT> time?
>
> The latter. I imagined that only one attribute of type ID could be
> in scope on an element at a given time. I should revise the
> description to make it clearer.

Right. I think that this makes situations where you have repeated
nested snippets from multiple namespaces, e.g.:

  <doc xml:idAttr="id">
    <rdf:RDF xml:idAttr="ID">
      ...
      <html:p xml:idAttr="id">
        ...
      </html:p>
      ...
      <html:p xml:idAttr="id">
        ...
      </html:p>
      ...
    </rdf:RDF>
    ...
  </doc>

really tedious to deal with.
  
> JT> xml:idAttrs would allow multiple attributes to be labelled as ID
> JT> attributes; in this example you could do:
>
> JT>   <foo xml:idAttrs="id ID">
> JT>     <bar id="fred" />
> JT>     <baz ID="barney" />
> JT>   </foo>
>
> Uh okay but lets now say that we have a namespace toto where id is
> an ID attribute and partnum is CDATA; and another namespace tata
> where partnum is an ID and id is CDATA. With your proposal I would
> be unable to describe the multi-namespace document

Note that I did say that xml:idAttrs was scoped (i.e. like option #6
rather than option #5, though you could include a version like option
#5 if you wanted) -- it doesn't *have* to appear on the document
element. In this situation you could use:

<?xml version="1.0" encoding="UTF-8"?>
<foo>
  <toto xml:idAttrs="id" id="zeus" partnum="a54321"
        xmlns="http://toto"/>
  <tata xml:idAttrs="partnum" id="hera" partnum="x12345"
        xmlns="http://tata"/>
</foo>

If you wanted you could use it in just the same way as xml:idAttr, but
you could also use it higher up if that was more convenient and it
didn't cause clashes. It's a superset of the functionality of
xml:idAttr.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 10 January 2003 12:17:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:47:15 GMT