Re: 4. ID assignment and the empty string

On Fri, 28 Jan 2005, Henry S. Thompson wrote:
> 
> Seems to me we're confusing two things here, which the XML REC (and
> xml:id as proposed) are careful to keep separate
> 
>  1) An attribute having type ID;
>  2) A string being the ID of an element.
> 
> (1) is necessary but not sufficient for (2).

Actually, in the current xml:id draft, it is.


> For (2) to hold additional things must be true:
> 
>   2a) The string must be a valid NCName;
>   2b) There must not be another attribute of type ID with the same
>       string value;
>   . . .

No, those conditions are necessary to have a conformant document, but 
xml:id does not require the UA to abort processing when it finds an error, 
and does require that the normalised value always be used for ID 
processing, and therefore even invalid values will be used as IDs.

Also, note that it is quite possible for an element to have multiple IDs 
already, e.g.:

   <!DOCTYPE p [
    <!ATTLIST p title ID #IMPLIED>
   ]>
   <p xmlns="http://www.w3.org/1999/xhtml"
      title="ID-per-XML"
      id="ID-per-XHTML"
      xml:id="ID-per-XMLID"/>

...and with DOM3 Core you can set even further attributes to be ID 
attributes, at which point the element could easily have four IDs.


> I don't see why it's necessary for xml:id to say anything more than it 
> has -- as Norm pointed out, [...] both have attributes of type ID, and 
> neither has an IDentified element.

Can you point to the text in the specifications that says that they do not 
have an IDentified element?


> UAs already do the right thing with the first case, I believe -- why 
> shouldn't they do the right thing with the second, without xml:id having 
> to say anything more than it does already?

The first case (an internal-subset-defined ID attribute normalising to the 
empty string) is currently ambiguous, as no ID processing is actually 
defined for XML documents. xml:id is significantly less ambiguous (which 
is good!) but in doing so makes the empty string into a value that can 
become an element's ID (albeit only in non-conforming documents, but Web 
authors are not exactly known for worrying about conformance).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 28 January 2005 10:16:27 UTC