On 23/10/2012 11:29, David Carlisle wrote:
> ...
another interesting feature is that in an entity declaration after a &
the following characters have to match the productions for entity or
character references (including a trailing colon) even though the
entities may not be used, so...
<!DOCTYPE x [
<!ENTITY foo "<![CDATA[ &hhh; ]]>" >
<!ELEMENT x (#PCDATA)*>
]>
<x>&foo;</x>
is well formed and valid, use of the reference to foo does not result in
an error, it is equivalent to:
<x> &amp;hhh; </x>
However if you remove the ; to get
<!DOCTYPE x [
<!ENTITY foo "<![CDATA[ &hhh ]]>" >
<!ELEMENT x (#PCDATA)*>
]>
<x>&foo;</x>
The result is not well formed:
$ rxp -xV ent.xml
Error: Expected ; after entity name, but got <space>
the use of & within an entity declaration has to be syntactically a
reference, even though if expanded the & would not start a reference as
it would be quoted by the CDATA declaration.
David
--
google plus: https:/profiles.google.com/d.p.carlisle
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________