Re: [xml] PEReferences - tricky and error-prone

On Mon, Jun 03, 2002 at 11:11:14AM +0200, Peter Jacobi wrote:
Dear All,

While trying to eliminate the last usage of ctxt->token, I had to do
some experiments with PERefences. As already the W3C REC points
out, PERefeferences are primary used to author tricky and
error-prone XML, and so I'm somewhat confused. 

Is the following is valid (current libxml2 votes no, as 
does XMLSpy 3.5):

<?xml version='1.0'?>
<!DOCTYPE root SYSTEM 't4.dtd'>

<!ENTITY % percent "&#x25;">
<!ENTITY %percent; def "ghi">
<!ENTITY abc "%def;">

This example tests, whether it is O.K. to have the
'%' of an EntitityDecl given by an PEReference.

It is stated in the REC section 2.8
The markup declarations may be made up in whole or in part of 
the replacement text of parameter entities. The productions later 
in this specification for individual nonterminals (elementdecl,
AttlistDecl, and so on) describe the declarations after all the 
parameter entities have been included.

Parameter entity references are recognized anywhere in the 
DTD (internal and external subsets and external parameter entities),
except in literals, processing instructions, comments, and the
contents of ignored conditional sections (see 3.4 Conditional
 Sections). They are also recognized in entity value literals. The use 
of parameter entities in the internal subset is restricted as described

So my reading of these two paragraphs imply, that the '%'
may be read from an PEReference.


  That sounds objectable because it inter-mixes 2 level. 
What does Xerces, MSXML and XP report about it ?  I could ask the XML Core
working group about this if there isn't a coherent set of results from parsers.
But I would be surprized if this wasn't covered as part of the XML Test suite
from W3C/NIST


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]