You might want to try using my XMLParser class. It translates the XML into ActionScript-friendly arrays/objects.
http://www.greensock.com/ActionScript/XMLParser.zip Jack Doyle -----Original Message----- Date: Thu, 26 Oct 2006 22:13:50 -0400 From: "Bill Pelon" <[EMAIL PROTECTED]> Subject: [Flashcoders] xml parsing problem I'm having trouble grabbing the right value from a node any help would be awesome.. I can't figure out where to increment as I'm going through my loop for the sub items. node structure below -------------------------------------------- <NetworkLeftnav> <mainItem name="main item name goes here" url="url goes here" window="_self" open="true"> <subItem> <text>sub item name goes here</text> <url>sub item URL goes here</url> <window>_self</window> </subItem> <subItem> <text>sub item name goes here # 2</text> <url>sub item URL # 2</url> <window>_self</window> </subItem> </mainItem> <mainItem name="main item 2" url="main item url #2" window="_self" open="false"> </mainItem> </NetworkLeftnav> AS below -------------------------------------------- onClipEvent(load){ function ExpandData(turbo){ var turboItem = turbo.firstChild.childNodes; var subItem = turbo.firstChild.firstChild.childNodes; trace("number of main section nodes" + turbo.firstChild.childNodes.length); // main section count for (var i = 0; i < turboItem.length; i++){ var turbo = turboItem[i]; // running through main nodes mainNavName = turbo.attributes.name; mainNavUrl = turbo.attributes.url; mainNavWindow = turbo.attributes.window; mainNavOn = turbo.attributes.open; // set to true or false trace("mainNaveName = " + mainNavName); trace("mainNaveURL = " + mainNavURL); trace("mainNaveWindow = " + mainNavWindow); trace("mainNaveOn = " + mainNavOn); if( turbo.childNodes.length >=1){ trace("this node has subcontent"); trace("number of subcontent nodes = "+ turbo.childNodes.length); turboChild = turbo.firstChild.firstChild; trace(" "); trace("total times to loop = " + turbo.childNodes.length); for (var n = 0; n < turbo.childNodes.length; n++){ trace("Subcounter incremental value = " + n); ///////////////// THESE NEED TO BE INCRIMENTED???????????? trace(turboChild.firstChild.nodeValue); // returns sub item name trace(turboChild.nextSibling.firstChild.nodeValue); // returns sub item URL trace(turboChild.nextSibling.nextSibling.firstChild.nodeValue); // returns sub itemWindow } } trace(" "); } } var turbo = new XML(); turbo.ignoreWhite = true; turbo.onLoad = function(success){ if (success) ExpandData(this); else trace("Error loading XML file"); } turbo.load("netnav.xml"); // what my xml is called that is posted above stop(); } _______________________________________________ [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

