AS2 will not support CDATA nodes. You should load in a schema that has a CDATA node first, then use that schema to write your text nodes to the CDATA node and pass the instance of the schema w/ the CDATA intact. I've had to use this work-around for another project I worked on a year ago.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Sinning Sent: Tuesday, June 19, 2007 11:38 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] how to get CDATA into an XML object Okay. I'm using AS2. How then do I get the actual xml out of the object? Muzak wrote: >AS2 or AS3? > >The XML class in AS3 has a toXMLString() method which will return the correct value. >toString() ignores CDATA in the output panel. This doesn't mean it isn't there. > >var str:String = '<TEXTFORMAT LEADING="2">'; >str+='<P ALIGN="LEFT">'; >str+='<FONT FACE="Arial" SIZE="12" COLOR="#000000">'; >str+='<B>Formatted content of a text field.</B>'; >str+='</FONT></P></TEXTFORMAT>'; >var xml:XML = new XML("<html><![CDATA[" + str + "]]></html>"); >trace(xml.toXMLString()); > >regards, >Muzak > >----- Original Message ----- >From: "Andrew Sinning" <[EMAIL PROTECTED]> >To: "Flash Coders" <flashcoders@chattyfig.figleaf.com> >Sent: Wednesday, June 20, 2007 12:14 AM >Subject: [Flashcoders] how to get CDATA into an XML object > > > > >>I can't figure out how to put CDATA into an xml object. Whether I use createTextNode( ) or create the xml with the CDATA directly, >>the XML object wants to scrub my input string: >> >>My goal is to store away the htmlText of TextField inside of an xml object. >> >>// textField is a TextField object >>var htmlOfTextField = textField.htmlText; >>trace(htmlOfTextField); >>/* >>output: >><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="12" COLOR="#000000"><B>Formatted content of a text >>field.</B></FONT></P></TEXTFORMAT> >>*/ >> >>// now, I want to build a node "html" containing an exact copy of htmlOfTextField >>var xmlRecord = new XML("<html><![CDATA[" + htmlOfTextField + "]]></html>"); >>trace(xmlRecord.toString()); >>/* >>output: >><html><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="12" >>COLOR="#000000"><B>Formatted content of a text >>field.</B></FONT></P></TEXTFORMAT></html> >>*/ >> >> >>Notice that the output above does not contain the mark-up "<![CDATA[ ... ]]> " and that the html string has been scrubbed. >>The result I want should look like this: >> >><html><![CDATA[ <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="12" COLOR="#000000"><B>Formatted content of a >>text field.</B></FONT></P></TEXTFORMAT>]]></html> >> >>Thanks for any help! >> >> > > >_______________________________________________ >Flashcoders@chattyfig.figleaf.com >To change your subscription options or search the archive: >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >Brought to you by Fig Leaf Software >Premier Authorized Adobe Consulting and Training >http://www.figleaf.com >http://training.figleaf.com > > > > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com