Understanding the XML Classes : XML Object « XML « Flash / Flex / ActionScript






Understanding the XML Classes

 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var myXML:XML = <message>Hello, world!</message>;
//        An XMLList is a numbered set of XML objects.
        var list:XML = <list>
                           <item id="58" />
                           <item id="135" />
                           <item id="12" />
                       </list>;
        var items:XMLList = list.item;
        trace(items);
        trace(items.length());
        trace(items[1].toXMLString());
    }
  }
}

        








Related examples in the same category

1.Creating an XML Object
2.Create the XML structure with a string
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