XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Why are erroneous ENTITY declarations not caught inXML validation?

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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS