# XPathAPI - trouble with XPath to specific node index

**URL:** <https://forum.kirupa.com/t/xpathapi-trouble-with-xpath-to-specific-node-index/220212>\
**Category:** flash\
**Created:** [March 23, 2007, 6:23pm UTC](https://forum.kirupa.com/t/xpathapi-trouble-with-xpath-to-specific-node-index/220212 "2007-03-23T18:23:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ironchefmoto](https://avatars.discourse-cdn.com/v4/letter/i/91b2a8/32.png) [@ironchefmoto](https://forum.kirupa.com/u/ironchefmoto)\
**Post date:** [March 23, 2007, 6:23pm UTC](https://forum.kirupa.com/t/xpathapi-trouble-with-xpath-to-specific-node-index/220212/1 "2007-03-23T18:23:04Z")

</div>

Here’s my sample XML:

```auto
<?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:

```auto
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
