I think the compiler is getting confused, when it sees "]]>", it is taking it for the end of the CDATA section.
Try this: ndv = "<![CDATA[" + ndv + "]]" + ">"; Andrew --- In [email protected], "khos2007" <[EMAIL PROTECTED]> wrote: > > Problem: > The String concatenation at the "ndv" variable causes a compile error. > How can I build a String with CDATA tag without an error? > > Purpose: > To build XML String at runtime. > > Thanks for any advice, > -- Keith -- > > See code below: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute"> > <mx:Script> > <![CDATA[ > private function testMethod():String > { > var ndv:String="Some text I wrote"; > ndv = "<![CDATA[" + ndv + "]]>"; > return ndv; > } > ]]> > </mx:Script> > </mx:Application> >

