Bonjour,
Je bloque à l'import d'un xml sur la création d'un tableau à 3 dimensions (troisième boucle FOR). Quelqu'un pourrait-il m'aider, s'il vous plait ?
Merci !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 mXML.onLoad = function(success) { if (success) { var theme = mXML.firstChild; for (i = 0; i < theme.childNodes.length; i++) { ptheme[i] = theme.childNodes[i].attributes.theme; stheme[i] = new Array(""); for (j = 0; j < theme.childNodes[i].childNodes.length; j++) { stheme[i][j] = theme.childNodes[i].childNodes[j].attributes.stheme; item[i][j] = new Array(""); item_index[j] = new Array(""); for (k = 0; k < theme.childNodes[i].childNodes[j].childNodes.length; k++) { item_index[j][k] = theme.childNodes[i].childNodes[j].childNodes[k].attributes.index; item[j][k] = theme.childNodes[i].childNodes[j].childNodes[k].firstChild; } } } play(); delete mXML; } }; mXML.load("ddata.xml");
LE XML
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 <?xml version="1.0" encoding="utf-8"?> <data> <th theme="nom"> <sth stheme="nom"> <item index="0">111</item></sth> <sth stheme="nom"> <item index="2">121</item> <item index="1">122</item></sth> <sth stheme="nom"> <item index="2">131</item> <item index="0">132</item></sth> </th> <th theme="nom"> <sth stheme="nom"> <item index="0">211</item> </sth> <sth stheme="nom"> <item index="2">221</item> <item index="2">222</item> </sth> <sth stheme="nom"> <item index="2">231</item> <item index="2">232</item> </sth> </th> </data>
Partager