[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: <!ENTITY amp "&38;">

  • From: "Richard L. Goerwitz" <richard@g...>
  • To: xml-dev@i...
  • Date: Wed, 02 Dec 1998 09:26:27 -0500

entity amp
David Brownell wrote:
> 
> Richard Tobin wrote:

> > > the file play.dtd contains the tag <!ENTITY amp "&#38;">
> >
> > 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 "&#38;"> 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 "&#38;"> 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 "&#38;"> as an
error.  Why?  Because it is superfluous and misleading.  Even in cases
where the entity isn't built-in (e.g., <!ENTITY AMP "&#38;">), 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 "&#38;">
    <!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 "&#38;"> 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@g...

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.