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):

t4.xml
<?xml version='1.0'?>
<!DOCTYPE root SYSTEM 't4.dtd'>
<root>&abc;</root>

t4.dtd
<!ENTITY % percent "&#x25;">
<!ENTITY %percent; def "ghi">
<!ENTITY abc "%def;">
<!ELEMENT root (#PCDATA)>

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
below.

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

Opinions?

  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

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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