Re: A uestion and possible problem

On Fri, 23 May 1997 10:00:23 -0400 (EDT) Gavin Nicol said:
>Well, the standard says:
>
>>XML allows parameter entity references in a variety of places within
>>the DTD. Parameter-entity references are always expanded immediately
>          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>upon being recognized, and the DTD must match the relevant rules of
>>the grammar after all parameter-entity references have been
>>expanded. In addition, parameter entities referred to in specific
>>contexts are required to satisfy certain constraints in their
>>replacement text; for example, a parameter entity referred to within
>>the internal DTD subset must match the rule for markupdecl.
>
>This seems to imply that in:
>
>  <!DOCTYPE foo [
>  <!ENTITY % pe   "'">
>  <!ENTITY % pe2  '&pe;&pe;' >

I think you mean
   <!ENTITY % pe2  '%pe;%pe;' >

>  ]>
>
>pe2 would be expanded to '''', which is illegal.
>
>I should note that neither NXP nor lark can handle my example.

I understood the spec differently, namely to mean that the replacement
text of pe2 should be stored not as %pe;%pe; but as '' -- the
floor is open for wording that makes clearer what is supposed to
happen here!  (What *is* supposed to happen is precisely what does
happen in SGML:  the parser sees

  <!ENTITY % pe2  '

and begins reading the replacement text and looking for its end.
It sees

  %pe;

and expands it, so the replacement text now consists of the single
character ' -- then it sees

  %pe;

and repeats the process.  Now it sees

  '
and stops recording the replacement text.  Then it sees

  >

and is out of the declaration.

I agree that (1) the behavior here and elsewhere needs to agree with
that of 8879, and (2) the wording needs to make clear what the behavior
should be.

-C. M. Sperberg-McQueen

Received on Friday, 23 May 1997 17:40:11 UTC