Re: Options for dealing with IDs

At 9:31 PM +0100 1/7/03, Chris Lilley wrote:

>Eew. So its an ID or not an ID depending on who asks?

Not really. The attribute is an attribute, period. Some processes may 
choose to use it in a certain way. Others may choose to use it in 
another way. How it's treated is a question for the process, not the 

>And would that
>mean that an IDREF from inside the document and a fragment identifier
>pointing to the same element from outside the document might give
>different results?

In theory yes. In practice, rarely, and that doesn't really bother me.

>ERH> However, no change is made to the attribute's type. All
>ERH> parsers will continue to report the attribute's type as they
>ERH> currently do, whether that's CDATA, ID,
>ERH> my-namespace:social-security-number, etc.
>ERH> This moves all the effort into the client application receiving data
>ERH> from the parser. It leaves XML 1.0 untouched.
>That is an advantage?

Absolutely. It's far more consistent. Two validating XML parsers 
reading a document will see the same content even if one was written 
a year after the other.

>ERH> Since XPointer is still open, that's easy to fix. DOM is the one that
>ERH> will have issues, but they aren't difficult.
>That merely sidesteps the issue by giving a parallel and contradictory
>declaration mechanism for one possible use of IDs, while leaving the
>other uses of IDs stranded - not even as badly off as they are now, but
>a little worse off.

I am not convinced that one solution fits all. A scheme that works 
for applications that read the external DTD subset (XSLT, DOM 
optionally) is not appropriate for applications that almost never 
read the external DTD subset (web browsing). The two schemes can be 
made consistent in any one document if that's important. Just declare 
the id attributes to have type ID.

Ultimately, the document is just a document. Len seems to think that 
we should make all processes read the DTD and accept what's written 
there. I'm going the opposite way. Each process applies the semantics 
to the document that make sense for it. This includes determining 
what is and isn't an ID.

| Elliotte Rusty Harold | | Writer/Programmer |
|           Processing XML with Java (Addison-Wesley, 2002)          |
|                 |
|  |
|  Read Cafe au Lait for Java News:      |
|  Read Cafe con Leche for XML News:    |

Received on Wednesday, 8 January 2003 11:02:42 UTC