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

Re: CDATA sections in W3C XML Infoset

  • From: David Carlisle <davidc@n...>
  • To: bkline@r...
  • Date: Sat, 31 Mar 2001 16:20:09 +0100

cdata replacing to gt

   In this case "my software" is the Xerces DOM parser, and yes, I am
   saying that this software treats <![CDATA[<a/>]]> differently from

yes the parser might flag all sorts of stuff like line numbers in the
source, comments etc, as well as cdata sections but why does the
application you layer over that care about cdata?

    1. The DOM gives you a different node type for the former than
       it gives you for the latter.

But they both have the same string content. If you give it
<![CDATA[<a>]]> or &lt;a&gt; then in both cases the DOM will pass you a
string of length three "<a>" in one case a CDATA node in the other a
text, but that only matters if you are some kind of editor and want to
write the file back in a way similar to  the source markup.

    2. If you hand the value of the node you get back for the former
       to an XML parser you get a successfully parsed document;
       if you hand &lt;a/&gt; to the parser it fails.

The text node will have the string <a> if you are seeing &lt;a&gt;
then you have walked over the string replacing < by &gt; But you
don't want to linearise the string as XML you don't want &gt; and you
don't want <![CDATA you just want to take the string as XML markup as it
stands, and the string is the same whether or not it was originally
marked with CDATA.


This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit


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.
First Name
Last Name
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.