[
Lists Home |
Date Index |
Thread Index
]
- From: "Richard L. Goerwitz" <richard@goon.stg.brown.edu>
- To: xml-dev@ic.ac.uk
- Date: Wed, 02 Dec 1998 09:26:27 -0500
David Brownell wrote:
>
> Richard Tobin wrote:
> > > the file play.dtd contains the tag <!ENTITY amp "&">
> >
> > This is not entirely surprising, since that file is dated 31 Jan 98
> >
> > IE 5 appears to be within its rights not to detect the error
>
> This is one of those areas where the XML spec gives too much (IMHO)
> leeway in terms of error reporting. While I think IE5 is doing a
> legal thing here, there's not much reason not to fully recover from
> this error in all cases, since "amp" is predefined and the original
> definition trumps the others. Most other parsers in fact adopt a
> rather different legal way to handle this error: ignore it totally!
Okay. <!ENTITY amp "&"> is not an error, because built-in entities
are already defined, by definition. And so this (duplicate) definition
ought to be ignored. Even if it isn't ignored, it doesn't matter. As
long as it never gets expanded, <!ENTITY amp "&"> isn't an error.
(And it won't get expanded, because the entity's replacement text will
already have been interned via the built-in definition).
Just for the record, STG's validator flags <!ENTITY amp "&"> as an
error. Why? Because it is superfluous and misleading. Even in cases
where the entity isn't built-in (e.g., <!ENTITY AMP "&">), and the
entity isn't used in the text anywhere, we still flag it as an error.
Why? Because again, such a definition is at best superfluous, and at
worse misleading in the sense that it may produce errors in document +
DTD combinations where the DTD was thought to be clean.
Just for fun, try typing
<!DOCTYPE xxx [
<!ENTITY amp "&">
<!ELEMENT xxx EMPTY>
]>
<xxx/>
into our validator (http://www.stg.brown.edu/service/xmlvalid/). You
will see both warning messages (about [incompatible] entity redefini-
tions) and error messages (about <!ENTITY amp "&"> having an in-
valid expansion - even though it's never actually used in the document
below).
Our early expansion of entities for the purpose of error correction is
a bit fascist, but the point is to encourage the writing of DTDs that
actually make 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
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|