Here’s my sample XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xml>
<media>
<playlist>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
</playlist>
<playlist>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
<clip>Sdfsdfadf</clip>
<clip>asdfsdfsdf</clip>
</playlist>
</media>
</xml>
In the XML onLoad event handler, I have been trying to read in JUST the first node using both of these approaches:
var xPathTemp:String = "/xml/media/playlist[0]";
var xPathData:Object = XPathAPI.selectNodeList(xmlData.firstChild, xPathTemp);
// OR
var xPathTemp:String = "/xml/media/playlist[0]";
var xPathData:Object = XPathAPI.selectSingleNode(xmlData.firstChild, xPathTemp);
The first method returns nothing – it’s blank when I trace xPathData. The 2nd method returns null. What am I missing here? I ONLY ever want to get the first <playlist> node using XPathAPI.
Thanks,
IronChefMorimoto