Thanks for the replies. That helped alot and I have now got it working thanks to your useful tips.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ben gomez farrell Sent: 10 September 2007 20:16 To: [email protected] Subject: Re: [Flashcoders] XML confusion I don't think you're doing anything wrong, its just that the trace function only accepts strings as parameters. So when you pass in your XML variable it would throw an error if you were using a more strict language like Actionscript 3 (at least I assume it throws an error in AS3, maybe it actually does the same thing). However, if you're using AS2, which is less strict, the trace function expects a string, so it'll try to convert your XML to a string, and it looks like its successful. It probably runs the XML.toString() method when it gets to the trace method. So you're not going to get anything from trace except for a converted string. And it'll do the same thing in your scriptPath string, because its going to convert that XML variable to a string. If you want more control, you might try looping through your XML to create a more custom string, and then use that. ben Paul Steven wrote: > I am trying to convert a string to xml but for some reason when I convert to > xml it only displays the "encoded string". See below the code snippet for > what is traced. Any idea what I am doing wrong? > > Here is my test file > > var encodedString:String = "encoded string"; > > var XMLString:String; > XMLString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; > XMLString += "<file>"; > XMLString += "<![CDATA[" + encoded string + "]]>"; > XMLString += "</file>"; > > trace ("XMLString = " + XMLString); // Trace 1 > > var dataToSend:XML = new XML(XMLString); > > trace ("dataToSend = " + dataToSend); // Trace 2 > > var scriptPath:String = uploadUrl + "?xml=" + dataToSend + "&key=" + _key + > "&session=" + _sessionId; > > ------------- > Trace Results > ------------- > 1. > XMLString = <?xml version="1.0" encoding="UTF-8"?><file><![CDATA[encoded > string]]></file> > 2. > encoded string > > > > _______________________________________________ > [email protected] > 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 > > _______________________________________________ [email protected] 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 _______________________________________________ [email protected] 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

