Home
Drumbeat Insight Forum Index Register FAQ Memberlist Search

Drumbeat Insight Forum Index » dndTree » Parsing through the XML Nodes recursively
Post new topic  Reply to topic View previous topic :: View next topic 
Parsing through the XML Nodes recursively 
PostPosted: Tue May 16, 2006 12:09 am Reply with quote
admin
Site Admin
Joined: 25 Oct 2005
Posts: 512
Here is a handy dandy function for parsing nodes the dndTree. Yes, you can use it for the standard Macromedia Tree component.

Remember, you can also use the myTree.dataProvider.firstChild..toString() to get the xml as well.

Code:

// test function to parse through the nodes
parseTest_btn.onRelease = function() {
   // parse nodes
   var xmlObj = dndTree.dataProvider;
   var level = 0;
   function parseNodeValues(xmlNode) {
         //create spacing
         var spacer = "";
         for (var j=0;j<level;j++) {
            spacer += " ";
         }
         trace(spacer + " - " + xmlNode.attributes.label +"");
         level++;
         if (xmlNode.hasChildNodes()) {
               for(var i =0;i<xmlNode.childNodes.length;i++) {
                     parseNodeValues(xmlNode.childNodes[i]);
               }
         }
         level--;
   }
   parseNodeValues(xmlObj.firstChild)
}
View user's profile Send private message Send e-mail
Parsing through the XML Nodes recursively 
PostPosted: Mon Jul 12, 2010 8:24 am Reply with quote
Inofalaoblini
Joined: 06 Jul 2010
Posts: 1
Location: Kazakhstan
Im parsing an XML structure with SuperObject.
the structure is quite complex and some items can have different subtree, with different type I mean nodename of nodes.

for example
Code:
View user's profile Send private message Send e-mail ICQ Number
Parsing through the XML Nodes recursively 
  Drumbeat Insight Forum Index » dndTree
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 6 Hours  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  


Powered by phpBB © 2001-2004 phpBB Group
Designed by Vjacheslav Trushkin