in reply to CDATA probelm in XML::SMart

When there is a text which contains the & and ; together with out any space this & is not parsed as & instead it throws error.

It sounds like content expects XML, but what you are passing isn't valid XML. A simple way to convert plain text to XML is

for ($text) { s/&/&amp;/g; s/'/&apos;/g; s/"/&quot;/g; s/</&lt;/g; s/>/&gt;/g; }

However, I'd recommend avoiding content completely. The whole point of the module is to provide much better means of accessing and changing data than low-level functions like content.

Also there are some binary data in my text.

That may be a problem.
XML/1.0 doesn't allow many characters.
XML/1.1 doesn't allow the NUL character (chr(0)).
You might have to alter your scheme to allow the binary bits to be base64-encoded.

use XML::SMART;

That should be use XML::Smart;. Case *is* important, even if what you have *appears* to work.

Replies are listed 'Best First'.
Re^2: CDATA probelm in XML::SMart
by KarthikK (Sexton) on Nov 21, 2007 at 18:49 UTC
    In content() i am passing the data. does content requires XML? The problem now is the XML::Smart does the encoding. but i dont want to do this but pass the data in CDATA node.
      Why? CDATA is actually worse than entity-encoding, and they're completely equivalent to XML parsers.
        problem is this xml is read by another system which expectes no binary data