W3C home > Mailing lists > Public > xml-editor@w3.org > July to September 1998

Re: parameter entity expansion

From: C M Sperberg-McQueen <cmsmcq@uic.edu>
Date: Tue, 11 Aug 1998 14:07:19 -0500
Message-Id: <199808111907.OAA242830@tigger.cc.uic.edu>
To: richard@goon.stg.brown.edu
CC: xml-editor@w3.org, cmsmcq@uic.edu
>Date: Tue, 11 Aug 1998 14:22:17 -0400
>From: "Richard L. Goerwitz III" <richard@goon.stg.brown.edu>

>Just as
>
>  <!ENTITY % firstpart "<!ELEMENT">
>  
>is invalid, so also should
>
>  <!ENTITY % firstpart "'start">

The first declaration is not, in itself, invalid.

>Wording:
>
>  Parameter entities may not expand to partial quoted strings
>  such as "'start" or "end&#39;".
>
>The reason it would be a bad idea to allow "'start" or "end&#39;"
>is that people will try things like:
>
>  <!ENTITY % firstpart "'start">
>  <!ENTITY % lastpart "end'">
>  <!ENTITY bothparts %firstpart;%lastpart;>

The example shown is illegal in SGML and should, I believe, be
illegal in XML; I need to consult the spec to see whether the current
wording effectively forbids it or not.  Note, however, that the
following example is legal SGML and should, I believe, be legal in
XML:

  <!ENTITY % firstpart "'start">
  <!ENTITY % lastpart "end'">
  <!ENTITY bothparts "%firstpart;%lastpart;">
  <!ENTITY legal     %bothparts; >

When the work group discussed the constraints on parameter entities,
the discussion made clear that although token-pasting of the kind
shown in this example can be confusing and error-prone, it is
nevertheless necessary for some things which the work group was 
loath to forbid.

>Does this make sense?

I think so.

-C. M. Sperberg-McQueen
Received on Tuesday, 11 August 1998 15:08:58 GMT

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