[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Entity-declarations and CDATA

  • From: "Falk, Alexander" <falk@i...>
  • To: xml-dev@i...
  • Date: Thu, 8 Jul 1999 12:33:57 +0200

cdata internet explorer
Hi,

in a previous message on Wednesday, July 7th, Frank Korf
[mailto:Frank.Korf@m...] 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@m...]
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@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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.