Hi All,
I want to select ONLY 2 CHILDNODES from a NODE which SATISFIES a criteria using XPATH in AS2.
To elaborate more, I want to get the Node Value of ‘title’ and ‘flvs’ Node for that ‘icon’ node whose ‘id’ has the value of 1.
Below is the XML file
<?xml version="1.0" encoding="UTF-8" ?>
<icons>
<icon ids="1">
<thumb>spidy.jpg</thumb>
<title>Spider-Man</title>
<flvs>spider.flv</flvs>
</icon>
<icon ids="2">
<thumb>bat.jpg</thumb>
<title>Bat-Man</title>
<flvs>bats.flv</flvs>
</icon>
<icon ids="3">
<thumb>super.jpg</thumb>
<title>Super-Man</title>
<flvs>super02.flv</flvs>
</icon>
<icon ids="4">
<thumb>heman.jpg</thumb>
<title>He-Man</title>
<flvs>heman.flv</flvs>
</icon>
</icons>
import mx.xpath.XPathAPI;
var xmlObj:XML = new XML();
xmlObj.ignoreWhite = true;
xmlObj.onLoad = function(success:Boolean)
{
trace('Loading XML file');
if(success)
{
trace('Displaying data');
var path:String = "/icons/icon[@ids=1]";
var title_array:Array = XPathAPI.selectNodeList(this.firstChild, path);
//[COLOR=Red]**Below line just print the 'thumb' value i.e spidy.jpg. How to skip this node and fetch rest 2 nodes value**[/COLOR]
trace(title_array[0].firstChild.firstChild.nodeValue);
}
else
{
trace('Error loading XML file');
}
};
xmlObj.load('../toons.xml');
Can anyone help me in this?
Thanks in advance.
Javed