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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: Entity-declarations and CDATA

[ Lists Home | Date Index | Thread Index ]
  • From: "Falk, Alexander" <falk@icon.at>
  • To: xml-dev@ic.ac.uk
  • Date: Thu, 8 Jul 1999 12:33:57 +0200

Hi,

in a previous message on Wednesday, July 7th, Frank Korf
[mailto:Frank.Korf@memi.com] wrote:

> I tried to use an entity-declaration as follows:
> 
> <!ENTITY trtd "<BEGIN><![CDATA[<TR><TD WIDTH=100%>]]></BEGIN>">
> 
> Neither Internet Explorer nor XML Spy do accept this. It's hard to
> understand what Internet Explorer really means with its error messages
> in german language, but XML Spy is unhappy about the "%". I can't
> see why this shoult not be allowed - but if not, how should I write
> it? AFAIK, Entities must not be resolved within a CDATA-Section, so I
> can't write it as an entity.

The problem is hidden in the order of interpretation that is being defined
by the XML Specs:

1) inside the DECLARATION of your entity trtd the word CDATA is not being
interpreted as anything special (and therefore the % inside is really NOT
allowed as a single character, because it is reserved for starting a
PE-Reference)

2) whenever your are USING your entity trtd in your document later on, the
CDATA section will be interpreted as such and therefore the % would be
allowed there

So the question becomse: how do I really have to write the % into the entity
declaration? The solution is to rewrite it like this:

<!ENTITY trtd "<BEGIN><![CDATA[<TR><TD WIDTH=100&#x25;>]]></BEGIN>">

This works, because the XML Specs clearly state, that character references
(such as &#x25; for the % sign) have to be resolved BEFORE the entity is
declared. And thus the entity ends up being declared exactly as you intended
to and later on is resolved correctly whenever you are using it in your
document.

I hope this helps, to clarify this rather tricky detail of the XML Specs -
and I also would like to add that both IE and XML Spy are doing the right
thing here ;)

Kind regards,

Alexander Falk

... Icon Informations-Systeme GmbH - makers of XML Spy -
http://www.xmlspy.com
... ALEXANDER FALK
... President, CEO
... http://www.icon.at/falk

-----Original Message-----
From: Frank Korf [mailto:Frank.Korf@memi.com]
Sent: Wednesday, July 07, 1999 11:07 PM

I tried to use an entity-declaration as follows:

<!ENTITY trtd "<BEGIN><![CDATA[<TR><TD WIDTH=100%>]]></BEGIN>">

Neither Internet Explorer nor XML Spy do accept this. It's hard to
understand what Internet Explorer really means with its error messages
in german language, but XML Spy is unhappy about the "%". I can't
see why this shoult not be allowed - but if not, how should I write
it? AFAIK, Entities must not be resolved within a CDATA-Section, so I
can't write it as an entity.

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