no nasty suprises

Michael has convinced me that

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

should be illegal (as it is in the 1.0 spec).  The reasoning is sound:
If the above is legal, then if somebody uses <test/> without a badde-
fault attribute, the default kicks in and causes an error message ("it
always worked before").  What's more the error isn't localized in the
markup itself, but it's back in the DTD, which was though to be okay.

This is the "no nasty surprises" principle.

If we adhere to this principle (which is probably not a bad idea where
it's convenient), then I'd suggest one slight change to the standard.
In section 2.9 (standalone decl), it's said that the standalone decl
must be "no" if attributes with default values exist in the external
DTD _and_ if the document uses markup for which these defaults are in-
terpolated by the processor (because they're missing).

I'd recommend shortening all of these conditions, and just saying:  The
standalone doc decl must be "no" if attributes with defaults are given
in the external DTD.  Same goes for entities.

This is just consistent.  The way things are, people can write docu-
ments using a given DTD, check them, and label them standalone="yes"
for processing or whatever (maybe they just leave the DTD reference
in because they're lazy; I don't know).  The point is that if you
define the requirement that standalone be "no" the way the spec does,
people can go merrily along using a document, then suddenly make a
change and have things go wrong that have nothing to do with the
change per se.

If we adhere to the "no nasty surprises" principle, we should shorten
all the verbiage here down to a simple statement:  If you have a DTD
with entities defined, or with attribute defaults, then your document
must say standalone="no".

It's simple, easy to apply, trivial to implement in a validator, and
forces people to do the right thing.

Does this make any sense?

-- 

Richard Goerwitz
PGP key fingerprint:    C1 3E F4 23 7C 33 51 8D  3B 88 53 57 56 0D 38 A0
For more info (mail, phone, fax no.):  finger richard@goon.stg.brown.edu

Received on Sunday, 21 June 1998 15:37:58 UTC