///XML EXAMPLE
var myXML:XML=<books><book cod="1" >
<title>ActionScript 3.0 Cookbook</title></book></books>;
trace("original xml: "+myXML);
///NAVIGATE NODE
trace('title node : '+myXML.book.title);
///READ ATTRIBUTE
trace('read cod attribute : '+myXML.book.@cod);
///ADD CHILDNODE
var newNode:XML=<book cod="2" >
<title>ActionScript 3.0 Bible</title></book>;
trace("add book node "+(myXML.book+=newNode));
///SELECT A NODE BY EXPRESSION
trace("select node with cod==2 "+myXML.book.(@cod==2));
///SELECT A NODE BY INDEX
trace("select first node "+myXML.book[0]);
///GET LENGTH
trace("get length of XMLList "+myXML.book.length());
///DELETE NODE
delete myXML.book[0];
trace("delete node "+myXML);
Wednesday, May 14, 2008
AS3 XML E4X
Subscribe to:
Posts (Atom)