Xml et flash

regaton Messages postés 24 Date d'inscription dimanche 27 février 2005 Statut Membre Dernière intervention 12 juillet 2005 - 31 mai 2005 à 11:57
corran706 Messages postés 1 Date d'inscription jeudi 23 février 2006 Statut Membre Dernière intervention 10 avril 2006 - 10 avril 2006 à 02:59
voila mon probleme!

J'utilise access pour créer une base de données, une fois ma base crée je l'exporte en fichier XML afin de pouvoir utiliser ma base dans flash.

mon fichier xml est comme ca

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="seb.xsd" generated="2005-05-31T10:49:47">

<DEP>30</DEP>
<TITRE>monsieur</TITRE>
<NOM>TOTO</NOM>
TITI

23 petite route
<CP>30000</CP>
<VILLE>NIMES</VILLE>
<MAIL>toto@tonton.fr</MAIL>

</dataroot>

voila...maintenant dans flash je veux afficher le contenu des balises dep, nom, prenom........

comment faire svp???

1 réponse

corran706 Messages postés 1 Date d'inscription jeudi 23 février 2006 Statut Membre Dernière intervention 10 avril 2006
10 avril 2006 à 02:59
var myXML = new XML();
myXML.ignoreWhite = true;
myXML.load("nomdufichier.xml");
myXML.onLoad = function(flag) {
if (flag) {
x = myXML.firstChild;
i = 0;
while (x.childNodes[i] != undefined) {
trace(x.childNodes[i].childNodes[0].firstChild.nodeValue);
trace(x.childNodes[i].childNodes[2].firstChild.nodeValue);
trace(x.childNodes[i].childNodes[3].firstChild.nodeValue);
i++;
}
}
};

Voila sa devrait marcher comme sa, si tu veux des explications...
0
Rejoignez-nous