OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Confused about & in entity literal

[ Lists Home | Date Index | Thread Index ]
  • From: Richard Tobin <richard@cogsci.ed.ac.uk>
  • To: roddey@us.ibm.com, xml-dev@ic.ac.uk
  • Date: Sat, 8 May 1999 00:31:13 +0100

>   <!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 "&lt;foo>">
>   ]>
>   <doc>&e;</doc>

The &lt; 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>&lt;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@ic.ac.uk
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@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

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

Copyright 2001 XML.org. This site is hosted by OASIS