Posted By

wintondeshong on 08/26/07


Tagged

textmate actionscript array xml filter associative


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

n00ge


filterXMLAssocArray


 / Published in: ActionScript
 

  1. // Filters specified tags from a supplied XML Node resource by tag name.
  2. // Returns a new associative array with the filtered tags' attributes.
  3. private function filterXMLAssocArray(filterNodeName:String, xmlNodes:Array):Array{
  4.  
  5. var tmpArray:Array = new Array();
  6.  
  7. var indexCounter:Number = 0;
  8. for (var i:Number = 0; i<xmlNodes.length; i++){
  9. if (xmlNodes[i].nodeName == filterNodeName){
  10. tmpArray[indexCounter] = new Array();
  11. tmpArray[indexCounter] = xmlNodes[i].attributes;
  12. indexCounter ++;
  13. }
  14. }
  15. return tmpArray;
  16. };

Report this snippet  

You need to login to post a comment.