Thanks Beau, 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>&lt;![CDATA[asdf]]&gt;></notes>

so I am a bit lost on this point.  any help would be appreciated.

thanks,
Hoyt


--- In [email protected], "Beau Scott" <[EMAIL PROTECTED]> wrote:
>
> ]]> is the closing tag to the mx:Script's escaped innards.
> 
>  
> 
> <mx:Script><![[CDATA
> 
>  
> 
> […]
> 
>  
> 
> ]]>
> 
> </mx:Script>
> 
>  
> 
> The xml parser ignores all markup between the opening and first closing
> cdata tags, so even though it's quoted it's still recognized as a cdata
> closing tag.
> 
>  
> 
> To get around it, try this:
> 
>  
> 
>  
> 
>             var tmpStr:XML = new XML("<![CDATA[asdf]]"+">");
> 
>  
> 
> Note that I've separated "]]>" into "]]"+">"
> 
>  
> 
> Beau Scott
> 
>  
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of hoytlee2000
> Sent: Thursday, February 21, 2008 2: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
> 
>  
> 
>  
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.20.9/1291 - Release Date:
2/21/2008
> 11:05 AM
> 
> 
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.516 / Virus Database: 269.20.9/1291 - Release Date:
2/21/2008
> 11:05 AM
>


Reply via email to