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

Entity replacements within attributes for CDATA

  • To: xml-dev@l...
  • Subject: Entity replacements within attributes for CDATA
  • From: Cabbar Duzayak <dcabbar@y...>
  • Date: Fri, 26 Mar 2004 12:48:19 -0800 (PST)

cdata within attribute
Hi,

I have an XML which is similar to:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TestData [<!ENTITY var1
'<![CDATA[testvalue]]>'>]>
<TestData>
  <Holder>
    <MyText
target="http://www.yahoo.com?aa=&var1;">Text
Source</MyText>
  </Holder>
</TestData>

When I try to parse this, I am getting an exception: 
'<' cannot appear in attribute value.

Looks like parser replaces &var1; with
"<![CDATA[testvalue]]>", and since attribute values
can not have "<" in them, this xml can not be parsed.
And the problem goes away if I replace the entity
definition with:

<!DOCTYPE TestData [<!ENTITY var1 'testvalue'>]>

However, I have to use CDATA here, cause I don't know
what the value of "var1" can be at runtime, and it
might contain quote characters or any other special
characters and it will be hard to deal with various
cases if I don't use CDATA...

Can you recommend any way I can resolve this issue?
Any ideas?

Thanks in advance...

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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.