You need to decode the entities first. 

function decodeEntities(entityString:String):String 
{
        var x:XML = new XML("<n>"+entityString+"</n>"); 
        x.parseXML();
        return x.firstChild.firstChild.nodeValue;
}



Jason Merrill
Bank of America  
GT&O Learning & Leadership Development
eTools & Multimedia Team


 

>>-----Original Message-----
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Steven Loe
>>Sent: Wednesday, April 04, 2007 11: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 "&amp;". 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 &amp; Jeff&apos;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;
>>              }
>>      }
>>}
>>
>>
>>
>>
>> 
>>______________________________________________________________
>>______________________
>>Expecting? Get great news right away with email Auto-Check. 
>>Try the Yahoo! Mail Beta.
>>http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
>>_______________________________________________
>>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

Reply via email to