Thanks Tracy, that gets rid of the parse error but now I am having
another problem with adding that XML element to an XML file I am
building. If I try to do this:
xmlFile.notes.tag = tmpStr;
I get an error saying that I need a closing tag </CDATA[]]>
if I add temp tags to the declaration:
var tmpStr:XML = new XML("<tag><![CDATA[asdf]]"+"></tag>");
I still get the same error, if I convert the above declaration to a
string i can add the element but it converts the string to this when I
print it out on in a text box.
<notes><![CDATA[asdf]]>></notes>
so I am a bit lost on this point. any help would be appreciated.
thanks,
Hoyt
--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> One way to do this is to break up the closing CDATA string:
>
> var tmpStr:XML = new XML("<![CDATA[" + notes.text + "]" + "]>");
>
> Tracy
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of hoytlee2000
> Sent: Thursday, February 21, 2008 4:44 PM
> To: [email protected]
> Subject: [flexcoders] CDATA XML element inside mxml
>
>
>
> Hello,
>
> I'm getting mixed up on how the syntax to create a CDATA element
> inside the script block in the mxml file. I do this and I get a parse
> error:
>
> var tmpStr:XML = new XML("<![CDATA[" + notes.text + "]]>");
> xmlFile.notes.tag = tmpStr;
> results.text = xmlFile.toXMLString();
>
> I tried to use a back slash to escape the "<" and ">" but that
> resulted in some inconsistent behavior with the second line when I
> read back the xml file as on the mac it reproduced the CDATA block and
> on the windows and linux side it removed the CDATA tags. Any help
> would be appreciated.
>
> Thanks,
> Hoyt
>