PDA

View Full Version : Entity-escaping Flash text to write to XML



thalamus
May 20th, 2009, 04:59 PM
Hello: I'm trying to expand on the Simple XML Editor in Flash to entity-escape the 5 special characters so they can be used in a CMS.

Say I have an XML file with the following node:

<item text="Apples &amp; Oranges" /> (entity-escaped)

If I entity-escape the ampersand by editing the raw XML file, then when I load the XML node into Flash, Flash displays the data correctly:

Apples & Oranges

However if I entity-escape the ampersand with XML editor in Flash:

var escapedString:String = origString(replace all "&" with "&amp;")
input_xml.firstChild.lastChild.attributes.text = escapedString;

then send the data to be written to the XML file, Flash ignores the entity-escaping and displays:

Apples &amp; Oranges

XML is encoded as UTF-8 (no BOM) with a DTD.

darren884
May 25th, 2009, 04:51 PM
Is there any reason you won't use elements instead of attributes so you can use CDATA?

thalamus
May 27th, 2009, 05:25 PM
Is there any reason you automatically assume I'd never heard of CDATA?

Thank you for your backhanded response. Fortunately for me I have found the answer elsewhere...