W3C home > Mailing lists > Public > xml-editor@w3.org > April to June 1998

Re: !ATTLIST El At NMTOKEN "$$$"

From: C M Sperberg-McQueen <cmsmcq@uic.edu>
Date: Fri, 19 Jun 1998 13:34:27 -0500
Message-Id: <199806191834.NAA147022@tigger.cc.uic.edu>
To: richard@goon.stg.brown.edu
CC: xml-editor@w3.org, cmsmcq@uic.edu
>Date: Thu, 18 Jun 1998 23:07:28 -0400
>From: "Richard L. Goerwitz III" <richard@goon.stg.brown.edu>
>
>I notice that Tim, in his annotated copy of the standard, mentions
>that the "Attribute Default Legal" constraint (XML 1.0, par 3.3.2)
>is an example of "belt and suspenders" thinking, preventing us from
>doing things like <!ATTLIST El At NMTOKEN "$$$">.
>
>I have to wonder, though:  If an attribute is never used, then why
>conjure up a validity constraint for it?  If somebody uses
>
>  <El At="$$$">
>
>in a document, this will immediately get flagged as an error.  Why
>create two constraints here where one will do nicely ("Values of type
>NMTOKEN must match the Nmtoken production", par 3.3.1)?

This constraint only covers the case if the default value of an
attribute declared NMTOKEN is "of type NMTOKEN".  What licenses
this inference?  As far as I see, what licenses this inference at
the moment is the constraint you are saying is redundant.  If it's
redundant, you should be able to prove to me, without appealing to
it, that the default value of your attribute At is required to be
of type NMTOKEN.  

If you can do so, then clearly there is redundancy.  If you can't,
there's not.

>Doubtless, validators will flag this error while still in the decl
>because it gets us closer to the source of the problem.
>
>But we don't actually have to mandate this behavior, do we?

I believe that the following document is in error under the
current rules, and should be in error in any revision of the rules:

 <!DOCTYPE test [
 <!ELEMENT test EMPTY>
 <!ATTLIST test
           baddefault NMTOKEN '(no value)' >
 ]>
 <test baddefault="haha"/>

Also to the point, I believe the following document is and should
be illegal:

 <!DOCTYPE test [
 <!ELEMENT test (child?)>
 <!ELEMENT child EMPTY >
 <!ATTLIST child
           baddefault (a | e | i | o | u) 'x' >
 ]>
 <test></test>

Failing to signal an error simply because the bad default is
never in fact used does not help the user, does not help the
DTD designer, and does not help the implementor.  It makes it
easier to create fragile DTDs, and harder to check DTDs for
sanity.

So:  no, we don't *have* to mandate this behavior.  But it would
be a mistake *not* to mandate it.

-C. M. Sperberg-McQueen
 Senior Research Programmer, University of Illinois at Chicago
 Editor, ACH/ACL/ALLC Text Encoding Initiative
 Co-coordinator, Model Editions Partnership

 cmsmcq@uic.edu, tei@uic.edu
Received on Friday, 19 June 1998 14:35:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:29 GMT