Im trying to parse this xml doc here is a link to the xml Doc
Here is a link to the Source code .fla
My traces are returning the correct information except when i try to call
trace(ans[0, 0, 2]); which sould result in this answer " 'EXPENDABLE MOLD SINGLE USE PATTERN EXPENDABLE MOLD MULTIPLE–USE PATTERN PERMANENT MOLD NO PATTERN"
Im getting ans[4 4 2] "THESE REGIONS COOL MORE RAPIDLY DUE TO HIGHER RATIO OF SURFACE AREA TO VOLUME"
The source code is below. Can you tell me what im doing wrong? I no there has to be an easier way to populate my array.
Any help would be great this is my first attempt at parsing a xml doc and using an array.
Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
//question
qst = [j, i, t];
//answer to question
ans = [j, i, t];
//Value of question
val = [j, i, t];
for (j=0; j<5; j++) {
//5 categories
for (i=0; i<5; i++) {//5 sets of different questions
for (t=0; t<1; t++) {
//One question
qst[j, i, t] = xmlNode.childNodes[j].childNodes[i].childNodes[t].firstChild.nodeValue;
trace(j+" "+i+" "+t+" qst[j][i][t]"+qst[j, i, t]);
}
for (m=1; m<2; m++) {//One value
val[j, i, m] = xmlNode.childNodes[j].childNodes[i].childNodes[m].firstChild.nodeValue;
trace(j+" "+i+" "+m+" val[j][i][m]"+val[j, i, m]);
}
for (n=2; n<3; n++) {//One answer
ans[j, i, n] = xmlNode.childNodes[j].childNodes[i].childNodes[n].firstChild.nodeValue;
trace(j+" "+i+" "+n+" ans[j][i][n]"+ans[j, i, n]);
}
}
}
} else {
content = "file not loaded!";
}
trace("end");
trace(ans[0, 0, 2]);
//Sould result to 'EXPENDABLE MOLD SINGLE USE PATTERN EXPENDABLE MOLD MULTIPLE–USE PATTERN PERMANENT MOLD NO PATTERN'
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("newgra2.xml");