An XML traversing question

Hi,

I have the following XML file structure:


<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:


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