Re: Options for dealing with IDs

At 20:02 2003 01 10 +0100, Chris Lilley wrote:

>I agree that the "what happens when DTD validation is performed" is
>still an issue that needs to be addressed. That might be as simple as
>saying "if you have an external or internal subset and you declare
>attributes to be of some other type than ID then interoperability will
>suffer so you should ensure, if you are wise, that the IDness is the
>same with and without DTD validation".
>
>Or we could try and say which wins (but I am fairly sure the DTD
>would win because of the ass-ba^H^H^H^H^H^H prior declaration wins
>design and the instance is read last. 

I'm still trying to digest all this thread--and I still don't know
what I think about the various suggestions--but I'd like to make
a comment here.

Suspecting that, by 'DTD' you mean external subset and by 'instance'
you mean (as far as declarations go) the internal subset, what
you say above isn't correct.

The internal subset is processed before the external subset.

In the case of entity declarations, all but the first are ignored.
So the first declaration of a given entity in the internal subset 
will cause any other declarations in (or referenced from) the internal 
subset and all declaration in the external subset to be ignored.

As far as ATTLIST declarations, multiple ATTLIST declarations for
a given element are allowed and all take effect (they are "merged").  
"When more than one definition is provided for the same attribute of 
a given element type, the first declaration is binding and later 
declarations are ignored."

In short, unless I've misunderstood you, it is not true that "the DTD wins."
In fact, the internal subset "wins" in most cases that multiple declarations
are allowed because it is processed first.

>Hence, a disparity between what
>is declared as ID in the well formed instance and what is (re)declared
>in the DTD might be best solved by authoring guidelines and best
>practice; people who don't follow that get exactly what they used
>to have, ie what is in the DTD is correct, and there is a disparity
>between  well formed and valid views of the document, so they are no
>worse off.

Rather, if someone declares a certain attribute to be of type ID in
the internal subset, that attribute will always be of type ID regardless
of what is said in the external subset.

>I propose that we deal with that by saying
>
>a) the DTD view wins; if the DTD says different things than the
>instance, that was your choice

No, as discussed above, the internal subset wins.

>b) best current practice is to reflect into the instance wha the DTD
>says about IDness

How about best current practice is to put your ID attlists into the 
internal subset.  Then it doesn't matter what is in your DTD or
whether you fetch/read/process the DTD or not (as far as the ID
issue is concerned).

>c) best current practice for new document types is to use a single
>attribute name for all attributes of type ID, where possible

Yep.  The combination of a, b, and c is what led me to mention
SGML's ATTLIST #ANY idea.  If this were allowed, your best practice
suggestion would end up being a suggestion to put something like:

  <!ATTLIST #ANY id ID #IMPLIED>

into your internal subset.

paul

Received on Saturday, 11 January 2003 13:05:56 UTC