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

[xml] PEReferences - tricky and error-prone



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?

Regards,
Peter Jacobi






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