My guess is that you were just using the node itself instead of getting nodeValue (basically using the toString() function). If that's the case then toString probably gives the raw data in the file, while using nodeValue does the full conversion of the data in the node.
-Andy On 4/4/07, Steven Loe <[EMAIL PROTECTED]> wrote:
Andrew, nodeValue works! I don't even have to convert the special characters to entities to have it display correctly. Thanks very much. Next Question: Do you understand How/Why it works? Thanks, Steven <> --- "Rost, Andrew" <[EMAIL PROTECTED]> wrote: > Play with nodeValue. As a test add the entity code into the XML file and use > nodeValue: > > // XML > <hut_data> > <title>Akbar & Jeff's ActionScript Hut</title> > </hut_data> > // > // AS > theClip.txt.text = xmlNode.firstChild.firstChild.nodeValue; > // > > instead of: > // XML > <hut_data> > <title>Akbar & Jeff's ActionScript Hut</title> > </hut_data> > // > // AS > theClip.txt.text = xmlNode.firstChild.firstChild; > // > > HTH - Andrew > -----Original Message----- > From: Steven Loe [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 04, 2007 10:24 AM > To: Flashcoders mailing list > Subject: [Flashcoders] Entities are Hell! > > I'm loading xml with special characters. These display as their entity codes > i.e. "&" as "&". If I put enitity codes in the xml, I still get entity > codes displaying on screen. What am I doing wrong? Any thoughts? Thanks!!! > > > Screen Output: > Akbar & Jeff's ActionScript Hut > > my_xml.xml: > <hut_data> > <title>Akbar & Jeff's ActionScript Hut</title> > </hut_data> > > > class: > class LoadXml { > private static var xmlUrl:String = "my_xml.xml"; > private var rootRef; > private var theClip:MovieClip; > > function LoadXml(rootRef) { > this.rootRef = rootRef; > var xmlDoc:XML = new XML(); > xmlDoc.ignoreWhite = true; > xmlDoc.onLoad = function(success:Boolean) { > if (success) { > this.owner.displayData(this); > } else { > trace("error loading xml"); > } > }; > Object(xmlDoc).owner = this; > xmlDoc.load(xmlUrl); > } > > private function displayData(xmlDoc:XML) { > var xmlNode:XMLNode = xmlDoc.firstChild; > if (xmlNode.nodeName.toString() == "hut_data") { > theClip = > this.rootRef.createEmptyMovieClip("theClip", 1); > theClip.createTextField("txt", 10, 10, 10, 250, 20); > theClip.txt.html = true; > theClip.txt.text = xmlNode.firstChild.firstChild; > } > } > } ____________________________________________________________________________________ Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 _______________________________________________ [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

