Create the XML structure with a string : XML Object « XML « Flash / Flex / ActionScript






Create the XML structure with a string

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var str:String = "<gamescore><username>username </username>"
                       + "<score>111</score></gamescore>";
        
        // Pass the string to the constructor to create an XML object
        var example:XML = new XML( str );
    }
  }
}

        








Related examples in the same category

1.Creating an XML Object
2.Understanding the XML Classes
3.Using Expressions within Literals: embed ActionScript code directly into your XML data.
4.Adding Attributes to an XML Element
5.Reading Elements in an XML Tree
6.Finding Elements by Name
7.Reading Text Nodes and Their Values