Ciao a tutti,
poco tempo fa grazie all'aiuto di questo forum e + in particolare di crescenzo sono riuscito ad estrapolare da un file xml dei dati in questa maniera:
codice:
filexml = "indicemodelle.xml";
ApriXML();
function ApriXML () {
mioxml = new XML();
myarray = new Array();
mioxml.load(filexml);
mioxml.onLoad = ElaboraXML;
function ElaboraXML (success) {
if (mioxml.loaded) {
myarray = mioxml.firstChild.nextSibling.childNodes;
for (i=0;i<=myarray.length;i++){
trace(myarray[i].childNodes.toString())
_root.primo=myarray[0].childNodes.toString()
_root.secondo=myarray[1].childNodes.toString()
_root.terzo=myarray[2].childNodes.toString()
_root.quarto=myarray[3].childNodes.toString()
_root.quinto=myarray[4].childNodes.toString()
_root.sesto=myarray[5].childNodes.toString()
_root.settimo=myarray[6].childNodes.toString()
_root.ottavo=myarray[7].childNodes.toString()
}
};
};
};
ora però ho dovuto per forze di causa maggiore
suddividere questo xml in otto xml tanti per quanti sono i campi che si trovavano al suo interno
per richiamarli sto facendo così per il primo ed il secondo (posto solo i primi 2)
codice:
filexml = "xml/indicemodelle.xml";
ApriXML();
function ApriXML () {
mioxmles = new XML();
myarray = new Array();
mioxmles.load(filexml);
mioxmles.onLoad = ElaboraXML;
function ElaboraXML (success) {
if (mioxmle.loaded) {
myarray = mioxmles.firstChild.nextSibling.childNodes;
{
_root.nomes=myarray[0].childNodes.toString()
}
}
}
}
/*
filexml = "xml/indicemodelle2.xml";
AprisXML();
function AprisXML () {
mioxmle = new XML();
myarraye = new Array();
mioxmle.load(filexml);
mioxmle.onLoad = ElaboraXML;
function ElaboraXML (success) {
if (mioxmle.loaded) {
myarraye = mioxmle.firstChild.nextSibling.childNodes;
trace ("Tot elementi = " + myarray.length);
for (i=0;i<=myarray.length;i++){
_root.nomesi=myarray[0].childNodes.toString()
}
}
}
}
morale mi carica soltanto 1 degli otto perchè??!? :master:
Grazie infinite a quanti mi c faranno capire qualcosa