# Using XML nodeValue as search criteria?

**URL:** <https://forum.kirupa.com/t/using-xml-nodevalue-as-search-criteria/183483>\
**Category:** flash\
**Created:** [March 27, 2006, 2:04pm UTC](https://forum.kirupa.com/t/using-xml-nodevalue-as-search-criteria/183483 "2006-03-27T14:04:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcc49](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mcc49/32/2247_2.png) [@mcc49](https://forum.kirupa.com/u/mcc49)\
**Post date:** [March 27, 2006, 2:04pm UTC](https://forum.kirupa.com/t/using-xml-nodevalue-as-search-criteria/183483/1 "2006-03-27T14:04:01Z")

</div>

I am in the process of making a search function for my XML file, is it possible to use a value of a node as a search criteria? I know you can use attributes but that would not be an efficient way for me to do this. The main functionI am trying to use at the moment looks something like this

```auto
function Search(menu_xml){
    
    var items = menu_xml.firstChild.firstChild.childNodes; 
    for (var i=0; i<items.length; i++) {
        
        if (items*.firstChild.nodeValue == _root.search) { 
            
            var name = items*.firstChild; 
            var info = items*.childNodes[1]; 
            
            _root.name_txt.text = name.firstChild.nodeValue;
            _root.info_txt.text = info.firstChild.nodeValue;
        }
    }
}

```

and my XML file is structured like

\<menu\>  
\<submenu\>  
\<item\>  
\<name\>xyz\</name\>  
\<info\>abc\</info\>  
\</item\>  
\</submenu\>  
\</menu\>

Maybe I am going at this in the wrong way bu any advice would be appreciated
