Posted By

damarev on 05/10/07


Tagged


Versions (?)

xmlToArray


 / Published in: ActionScript
 

  1. xmlToArray = function (_xml) {
  2. var _arr = new Array();
  3. for (var i = 0; i<_xml.childNodes.length; i++) {
  4. switch (_xml.childNodes[i].childNodes[0].nodeType) {
  5. case 1 :
  6. _arr[_xml.childNodes[i].nodeName] = xmlToArray(_xml.childNodes[i]);
  7. break;
  8. case 3 :
  9. _arr[_xml.childNodes[i].nodeName] = _xml.childNodes[i].childNodes[0].nodeValue;
  10. break;
  11. }
  12. }
  13. return _arr;
  14. };

Report this snippet  

You need to login to post a comment.