• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Using CDATA in Script (XML)

Guest
Feb 01, 2013 Feb 01, 2013

Copy link to clipboard

Copied

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.

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 04, 2013 Feb 04, 2013

Copy link to clipboard

Copied

What if you passed a string to the XML constructor instead of actual XML?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 05, 2013 Feb 05, 2013

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines