I'm trying to create an XML var using CDATA to get some htmlText.
<fx:Script> <![CDATA[ var newXML:XML = XML("<node><![CDATA["+ myRichTE.htmlText+" ]]></node>") ]]> <fx:Script> <mx:RichTextEditor id="myRichTE" />
But i get an error on this line. (give it a try, something about an unclosed tag, can't give the exact english error message since i got french UI)
It seems that you can't use
in Script section of an Application (in addition of the main CDATA which contains all Script), since it interprets as a real CDATA.
And I think I can't do without it to store the htmlText inside an XML node.
Any ideas ?
(maybe by "escaping" the CDATA tag ?)
Thanks a lot.
What if you passed a string to the XML constructor instead of actual XML?
Indeed, actually, it is as simple as this :
<fx:Script> <![CDATA[ myXMLnode = myRichTE.htmlText ]]> <fx:Script> <mx:RichTextEditor id="myRichTE" />
It is correctly inserted into the XML, by replacing tags with their corresponding html entities.