2 Replies Latest reply on Feb 5, 2013 1:49 AM by okpoubelle

    Using CDATA in Script (XML)

    okpoubelle Level 1

      Hello,

       

      I'm trying to create an XML var using CDATA to get some htmlText.

       

      Sample:

      <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

      <![CDATA[xxxx]]>
      

      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.