PEReferences in Entity Values of the Internal Subset

Given the following XML document

<!DOCTYPE doc [
  <!ELEMENT doc ANY>
  <!ENTITY % bar "test" >
  <!ENTITY   foo "%bar;" >
]>
<doc>&foo;</doc>

the PEReference %bar; is according to the WFC "PEs in Internal Subset" ("In the
internal DTD subset, parameter-entity references can occur only where markup
declarations can occur, not within markup declarations") not recognized.  So the
replacement text of the entity 'foo' is '%bar;' and the resolved content of the
XML document is

<doc>%bar;</doc>

Given the following XML document

<!DOCTYPE doc [
  <!ELEMENT doc ANY>
  <!ENTITY % bar "test" >
  <!ENTITY   foo "%bar" >
]>
<doc>&foo;</doc>

the entity declaration of foo is not well-formed (cf. prod. [9]).

Comparing these cases the treatment of the '%' character seems to be
inconsistent.  The first document passes a WF-test due to a PEReference which is
then not recognized, while the second document violates a WFC, though the '%'
character in an entity value of an internal subset will never signify the start
of a PEReference.

So it is either superfluous to consider PEReferences in the prod. of
EntityValue, which should then read

[9] EntityValue ::= '"' ([^&"] | Reference )* '"'
                    | "'" ([^&'] | Reference )* "'"

or the WFC "PEs in Internal Subset" should be modified to read:

"In the internal DTD subset, parameter-entity references can occur only where
markup declarations can occur or in an internal entity's literal entity value
..."  (Am I right, that this was the intention of the XML spec? Cf. also the
definition of "Reference in Entity Value" in 4.4. and "Included in Literal" in
4.4.5. However, these are not making an explicit statement about internal
subsets)

-- 
=====================================================================
 Dieter Köhler, M. A. - dieter.koehler@ppp.uni-bamberg.de
 Schiffgasse 4a, D-69117 Heidelberg, +49(0)6221-485995
 "http://www.philo.de/Philosophie-Seiten/": 1000+ Philosophie-Links
 "http://www.philo.de/VirtualLibrary/14.de.htm": Deutsche Philo-Links
 "http://www.philo.de/xml/": Open XML - XML-Komponenten für Delphi
=====================================================================

Received on Tuesday, 18 December 2001 18:11:21 UTC