parameter entity expansion

Just as

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

  <!ENTITY % firstpart "'start">

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 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
STG

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