# Help with searching an XML

**URL:** <https://forum.kirupa.com/t/help-with-searching-an-xml/312332>\
**Category:** Uncategorized\
**Created:** [July 30, 2010, 8:47pm UTC](https://forum.kirupa.com/t/help-with-searching-an-xml/312332 "2010-07-30T20:47:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lletdownl](https://avatars.discourse-cdn.com/v4/letter/l/6a8cbe/32.png) [@lletdownl](https://forum.kirupa.com/u/lletdownl)\
**Post date:** [July 30, 2010, 8:47pm UTC](https://forum.kirupa.com/t/help-with-searching-an-xml/312332/1 "2010-07-30T20:47:29Z")

</div>

Hello everyone. So, ive used this very helpful tutorial [http://www.kirupa.com/web/xml/examples/searchbestof.htm](http://www.kirupa.com/web/xml/examples/searchbestof.htm) to set up my own serachable XML database.

However, i need an extra depth of information in my database which the search function laid out in that tutorial doesnt address, and frankly, the nested loops are really confusing me.

Here is the basic set up for my XML … there will be 100 or more entries like this…

```auto

<?xml version="1.0" ?>

<All>
	<project>
		<title>xxx xxxxx avenue</title>
		<location>new york, new york</location>
		<info>
			<type>office</type>
			<status>design 1985 / completion 1989</status>
			<page><![CDATA[<a href="http://www.xxxxxxxxxx.com/lex425.html" target="_blank">425 lexington avenue</a>]]></page>
		</info>
	</project>		

</All>

```

and here is my search function in AS2

```auto

SearchXML = function(nodes, query, useChildElements){
	var results = [];
	for (var i=0; i<nodes.length; i++){
		for (var j=0; j<nodes*.childNodes.length; j++){
			currNode = nodes*.childNodes[j];
			if (useChildElements.contains(currNode.nodeName)){
				if (currNode.firstChild.nodeValue.contains(query)){
					results.push(nodes*);
					break;
				}
			}
		}
	}
	return results;
}

```

What i need is a flash code that will search the \<info\> section of the XML above. Which means i need it to search childNodes[x].firstChild.firstChild.nodeValue and childNodes[x].firstChild.nextSibling.firstChild.nodeValue  
while the SearchXML script only goes as deep as firstChild.

I would really appreciate any help. Thanks in advance!
