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

parameter entity expansion

From: Richard L. Goerwitz III <richard@goon.stg.brown.edu>
Date: Tue, 11 Aug 1998 14:22:17 -0400
Message-Id: <199808111822.OAA12766@goon.stg.brown.edu>
To: xml-editor@w3.org
Just as

  <!ENTITY % firstpart "<!ELEMENT">
is invalid, so also should

  <!ENTITY % firstpart "'start">


  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 problem with this is a) the parameter entities will get pad-
ded with spaces, leading to unexpected results, and b) implementa-
tions must now expand %firstpart; and %lastpart; before parsing
the line (if %firstpart; then the input stream is examined, no
closing quote will be found).

It is preferable to allow implementors to make decisions like this
(incremental expansion vs. chunked expansion) on their own.  And
it is preferable not to allow people to do things that will create
unanticipated results like

  &bothparts -> 'start end'

with a space in between the "start" and "end", despite that fact
that %firstpart; and %lastpart; have no spaces in their defs, and
that bothparts has no space between them.

Does this make sense?

Richard Goerwitz
Received on Tuesday, 11 August 1998 14:21:57 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:37:39 UTC