# An XML traversing question

**URL:** https://forum.kirupa.com/t/an-xml-traversing-question/309767
**Category:** flash
**Created:** [May 24, 2010, 2:20pm UTC](https://forum.kirupa.com/t/an-xml-traversing-question/309767 "2010-05-24T14:20:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![eb\_dev](https://avatars.discourse-cdn.com/v4/letter/e/c57346/32.png) [@eb\_dev](https://forum.kirupa.com/u/eb_dev)
#### Post date: [May 24, 2010, 2:20pm UTC](https://forum.kirupa.com/t/an-xml-traversing-question/309767/1 "2010-05-24T14:20:10Z")

</div>

Hi,

I have the following XML file structure:

```auto

<VideoData>
    <CuePoints>
        <CuePoint>
            <Name></Name>
            <Type>navigation</Type>
            <Start>0</Start>
            <End>20</End>
        </CuePoint>
        <CuePoint>
            <Name>Intro</Name>
            <Type>navigation</Type>
            <Start>11000</Start>
            <End>30000</End>
        </CuePoint>
     </CuePoints>
</VideoData>

```

And I am trying to create a function which will search the cuepoints for a specific time, I’d also like the function to be re-useable, so I could just feed it a xml tree path and a search term then it would return a reference to the matching node.

So far I have only managed to return what is in the node:

```auto

public class Search
    {
        public static var returnData:Array = new Array();
        
        public static function searchXMLList(xmlList:XMLList, searchterm:String, recursive:Boolean):Array
        {
            var nodes:Number = xmlList.length();

            for(var i:Number = 0; i < nodes; i++)
            {
                if(xmlList* == searchterm)
                    returnData.push(xmlList*);
            }
            return returnData;
        }
}

```

What is the best way to approach this?

Thanks,

eb\_dev
