> I'm using Xerces-C++ 2.1, with the binaries downloaded from the Apache
> site.  My code was compiled with MS VC++ 6.0.

I think this is fixed in Xerces-C++ 2.2.   Please try again and let us know
if problem persists.

Tinny
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 10:36 AM
Subject: Problem with DOMWriter output for CDATA node


> I'm having a problem where DOMWriter is not handling CDATA sections as I
> expected. I've search through bugzilla, and not found anything like my
> problem.
>
> Here's whats happening.  First, I get a DOMDocument by parsing this xml:
> <?xml version="1.0" encoding="US-ASCII" standalone="no" ?>
> <TestXML>
>   <Test2>
>     <![CDATA[Here's data that includes xml-like stuff( <, >, etc. )]]>
>   </Test2>
> </TestXML>
>
> Then, I get a DOMWriter object, and call writeNode, passing in the
> DOMDocument from the parser. Here is the xml I get from that:
> <?xml version="1.0" encoding="US-ASCII" standalone="no" ?>
> <TestXML>
>   <Test2>
>     <![CDATA[Here's data that includes xml-like stuff( &lt;, >, etc. )]]>
>   </Test2>
> </TestXML>
>
> My problem is that the left angle bracket was changed to "&lt;", which
> would be fine, if it wasn't in a CDATA section.  Note that the right angle
> bracket came though unchanged.
>
> Here's the code I used to call DOMWriter::writeNode:
> void XMLDocument::getXML( char *&xml,
>                           const char *encoding,
>                           bool readable )
> {
>   DOMImplementationLS *impl =
>     DOMImplementationRegistry::getDOMImplementation( LS );
>   DOMWriter *writer = impl->createDOMWriter();
>   // force pretty print:
>   if (writer->canSetFeature( XMLUni::fgDOMWRTFormatPrettyPrint, true ) )
>   {
>     writer->setFeature( XMLUni::fgDOMWRTFormatPrettyPrint, true );
>   }
>   // Set the encoding to US-ASCII for now
>   writer->setEncoding( XMLUni::fgUSASCIIEncodingString );
>   // create a format target to recieve the resulting XML string
>   MemBufFormatTarget *target = new MemBufFormatTarget;
>   // serialize the DOM
>   writer->writeNode( target, *mDoc );
>   // make a copy of the result
>   xml = XMLString::replicate( ( const char * )target->getRawBuffer() );
> }
>
> I'm using Xerces-C++ 2.1, with the binaries downloaded from the Apache
> site.  My code was compiled with MS VC++ 6.0.
>
> I'm pretty new at this, and expect that I've just misunderstood something.
>
> Any help is appreciated!
>
> Marc Robertson
> Staff Consultant
> AWD Development
> DST Systems, Inc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to