Re: Confused about & in entity literal
> <!DOCTYPE doc [ > <!ELEMENT doc (#PCDATA)> > <!ENTITY e "<![CDATA[&foo;]]>"> > ]> > <doc>&e;</doc> Hmmm, this one *is* a little strange. Let's consider the other one first: > <!DOCTYPE doc [ > <!ELEMENT doc (#PCDATA)> > <!ENTITY e "<foo>"> > ]> > <doc>&e;</doc> The < is *not* expanded when the entity is defined. It is a general entity (that it's built-in makes no difference) and is "bypassed" in the terminology of section 4.4. So it's just as if the body had been <doc><foo></doc> which is perfectly well-formed. Back to the first example. What's strange about it is that I believe that <!ENTITY e "<![CDATA[&foo]]>"> (note the missing semicolon) would not be well-formed, even though there turns out not to be an entity reference when it is expanded in the body! In the original, &foo; is (by production 9) an entity reference when it appears in the entity definition (and it is bypassed), but is not an entity reference when it is parsed in the body. -- Richard xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format