[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Why are erroneous ENTITY declarations not caught inXML validation?
- From: David Carlisle <davidc@nag.co.uk>
- To: "Costello, Roger L." <costello@mitre.org>,"xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Tue, 23 Oct 2012 11:51:01 +0100
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> &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.
________________________________________________________________________
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]