I’m being fed xml from an outside source, I currently load this xml file into Flash 8 using the xPathAPI. The XML file resembles this:
[size=1]
[/size]
[size=1]<aRequest>
<answer1>blah</answer1>[/size]
[size=1] <answer1>blah</answer1> [/size]
[size=1] <answer1>blah</answer1>[/size]
[size=1] <answer1>blah</answer1>[/size]
[size=1] <TheStuffINeed id="1">[/size]
[size=1] <stuff1>12345</stuff1>[/size]
[size=1] <stuff2>12345</stuff2>[/size]
[size=1] <stuff3>12345</stuff3>[/size]
[size=1] <stuff4>12345</stuff4>[/size]
[size=1] </TheStuffINeed>[/size]
[size=1] .[/size]
[size=1] .[/size]
[size=1] .[/size]
[size=1]</aRequest>[/size]
my AS resembles this:
[size=1]xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.load(whereEver);
xmlData.onLoad = function(success) {[/size]
[size=1]xmlNode = this.firstChild; [/size]
[size=1] [/size]
[size=1] var xmlPath:String = "/aRequest/TheStuffINeed";
var PileOfCrap = XPathAPI.selectNodeList(xmlData, xmlPath);
total = PileOfCrap.length;
for (var i = 0; i<total; i++) {[/size]
[size=1] myMXL = PileOfCrap*;
var myVal = XPathAPI.selectNodeList(myXML, "TheStuffINeed/stuff2");
thisVal = new Object;
thisVal = myVal[0].firstChild.nodeValue;[/size]
[size=1] [/size]
[size=1] CrapToDisplay* = thisVal;[/size]
[size=1] }[/size]
[size=1]}[/size]
[size=1][/size]
[size=1]The limitation here is I can’t seem to figure out how to query my already loaded xml file based on a string eg. TheStuffINeed["@stuff4=‘whatever’]" or aRequest/TheStuffINeed["@stuff4=‘whatever’]"[/size]
[size=1][/size]
[size=1]I don’t want to have to load the xml on each pass of a value. is there any way to sort through and query this, am I missing something here??? is this the wrong way to go? [/size]
[size=1][/size]
[size=1]If anyone has any thoughts, ideas, another way to accomplish this task, or the meaning of life, it would be greatly appreciated.[/size]