Originariamente inviato da negatyve
Uhm, e il contenuto del file as?Se lo copio dentro funziona tuttocodice://-------------------------------------------------------------------------- // Trasforma la struttura "node" ricevuta in ingresso in un array di oggetti //-------------------------------------------------------------------------- function xmlMediaNodesToArray(node:Object):Array { var sites:Array = new Array(); var site:Object; var siteNode:Object; var childNode:Object = node.firstChild; while (childNode != null) { // Create a new site Object to store the data. site = xmlAttributesToObject(new Object(), childNode); siteNode = childNode.firstChild; while (siteNode != null) { site[siteNode.nodeName] = siteNode.firstChild.nodeValue; siteNode = siteNode.nextSibling; } sites.push(site); childNode = childNode.nextSibling; } return sites; } //-------------------------------------------------------------------------- // serve per trasformare un nodo figlio in un oggetto //-------------------------------------------------------------------------- function xmlAttributesToObject(o:Object, node:Object):Object { var a:Object = node.attributes; for (var i in a) { o[i] = a[i]; } return a; } //-------------------------------------------------------------------------- function init(nameXMLfile:String){ myXml=new XML(); // crea una variabile che può contenere un documento XML myXml.ignoreWhite = true; myXml.load(nameXMLfile); }


Rispondi quotando