logo       

Re: Patch for XML::Writer: msg#00077

lang.perl.xml

Subject: Re: Patch for XML::Writer

--- Duncan Cameron <duncan_cameron2002@xxxxxxxxxxx>
wrote: > At 09:28:06 on 2003-12-23 srinithan
> <srinithan@xxxxxxxxxxx> 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

Yes you are right. I fixed it.
Iam attaching the patch with this mail.

Thanks
Srini T

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones.
Go to http://in.mobile.yahoo.com

Attachment: xml_writer.patch
Description: xml_writer.patch

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise