ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: Patch for XML::Writer
by Duncan Cameron other posts by this author
Dec 23 2003 3:10PM messages near this date
view in the new Beta List Site
Re: LibXML 1.56 with what libxml2? | Re: Patch for XML::Writer
At 09:28:06 on 2003-12-23 srinithan <srinithan@[...].in>  wrote:

> Hi Ed,
> 
> As of now, we cannot add a CDATA ( character data ) 
> to an XML document using XML::Writer.
> 
> I patched it in the following way and attached the
> same with this mail.
> 
> diff -c -b -r old_xml_writer/ new_xml_writer/ >
> xml_writer.patch
> 
> we can add a cdata in the following ways:
> ----------------------------------------
> Ex 1: 
> $writer->startTag("greeting");
> # Insert CDATA "Hello, world"
>  $writer->cData("Hello, world");
>  $writer->endTag("greeting");
> 
> Ex2:
> $writer->cdataElement("greeting", "Hello world");
> 
The way that you are dealing with an embedded ]]>  sequence within the
data to be written as CDATA is incorrect. You cannot just escape the > ,
remember that you're writing CDATA and everything is treated literally
including escape sequences when the document is parsed.
I think that the only valid thing to do is to break the data on the ]]> 
sequence, close the CDATA section, write the ]]>  as ordinary data
(escaping the >  character), then start a new CDATA section.

Regards
Duncan


_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Duncan Cameron
=?iso-8859-1?q?srinithan?=
Ed Avis
Michel Rodriguez

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved