PDA

View Full Version : toXmlString And Removing CR and LF characters


brixel
08-15-2008, 05:38 PM
Hey guys,

I'm storing the "toXMLString" value of an XML object and I'd like to remove the embedded carriage-return and line-feed characters in the string. I've tried replacing on "\r" and "\n", replacing for "fromCharCode ( 13 ) and ( 10 )", but no luck, they still come through.

Can someone tell me how to target these characters and remove them from my string? I need the XML to be stored as a flat string with no extra space between the nodes. Thanks.

Sly_cardinal
08-16-2008, 01:31 PM
Turn off pretty print on the XML instance.

From the Actionscript help:

var xml:XML = <foo>
<bar/>
</foo>;
XML.prettyPrinting = false;
trace(xml.toXMLString());

XML.prettyPrinting = true;
trace("\n" + xml.toXMLString());