# XML searchable database

**URL:** <https://forum.kirupa.com/t/xml-searchable-database/231916>\
**Category:** flash\
**Created:** [July 9, 2007, 3:45pm UTC](https://forum.kirupa.com/t/xml-searchable-database/231916 "2007-07-09T15:45:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisTheGrigg](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@ChrisTheGrigg](https://forum.kirupa.com/u/ChrisTheGrigg)\
**Post date:** [July 9, 2007, 3:45pm UTC](https://forum.kirupa.com/t/xml-searchable-database/231916/1 "2007-07-09T15:45:52Z")

</div>

Hi,

I have recently followed the a tutorial on [Kirupa.com](http://Kirupa.com) to search an XML file:

[http://www.kirupa.com/web/xml/examples/searchbestof.htm](http://www.kirupa.com/web/xml/examples/searchbestof.htm)

I am trying to edit it so when looping the XML file is performed, it goes down a level in other words the tutorials XML is based like this:

[COLOR=red]\<?xml version=“1.0” ?\>  
\<bestof url="[/COLOR][[COLOR=red]http://www.kirupaforum.com/forums/forumdisplay.php?f=12[/COLOR]](http://www.kirupaforum.com/forums/forumdisplay.php?f=12)[COLOR=red]"\>  
\<post url="[/COLOR][[COLOR=red]http://www.kirupaforum.com/forums/showthread.php?t=43216[/COLOR]](http://www.kirupaforum.com/forums/showthread.php?t=43216)[COLOR=red]"\>  
\<title\>xml menu DONE :)\</title\>  
\<author\>hga77\</author\>  
\<message\>  
\<![CDATA[Happy New Year kirupa]]\>  
\</message\>  
\</post\>[/COLOR]  
[COLOR=red] \<post url="[/COLOR][[COLOR=red]http://www.kirupaforum.com/forums/showthread.php?t=43216[/COLOR]](http://www.kirupaforum.com/forums/showthread.php?t=43216)[COLOR=red]"\>  
\<title\>xml menu DONE :)\</title\>  
\<author\>hga77\</author\>  
\<message\>  
\<![CDATA[Happy New Year kirupa]]\>  
\</message\>  
\</post\>[/COLOR]

and mine like this:

[COLOR=red]\<?xml version=“1.0” ?\>  
\<bestof url="[/COLOR][[COLOR=red]http://www.kirupaforum.com/forums/forumdisplay.php?f=12[/COLOR]](http://www.kirupaforum.com/forums/forumdisplay.php?f=12)[COLOR=red]"\>  
\<post url="[/COLOR][[COLOR=red]http://www.kirupaforum.com/forums/showthread.php?t=43216[/COLOR]](http://www.kirupaforum.com/forums/showthread.php?t=43216)[COLOR=red]"\>  
\<title\>[/COLOR]  
[COLOR=red] \<message\>  
\<![CDATA[Happy New Year kirupa]]\>  
\</message\>[/COLOR]  
[COLOR=red] \</title\>  
\</post\>[/COLOR]  
[COLOR=red] \<post url="[/COLOR][[COLOR=red]http://www.kirupaforum.com/forums/showthread.php?t=43216[/COLOR]](http://www.kirupaforum.com/forums/showthread.php?t=43216)[COLOR=red]"\>  
\<title\>[/COLOR]  
[COLOR=red] \<message\>  
\<![CDATA[Happy New Year kirupa]]\>  
\</message\>[/COLOR]  
[COLOR=red] \</title\>  
\</post\>[/COLOR]

So I want to go firstChild.firstChild rather than firstChild.

The loop code is as follows:

[COLOR=#000050]SearchXML[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#006610]function[/COLOR][COLOR=#0000ff]([/COLOR][COLOR=#000050]nodes[/COLOR], [COLOR=#000050]query[/COLOR], [COLOR=#000050]useChildElements[/COLOR][COLOR=#0000ff]){[/COLOR] [COLOR=#006610]var[/COLOR] [COLOR=#000050]results[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#0000ff][][/COLOR]; [COLOR=#006610]for[/COLOR] [COLOR=#0000ff]([/COLOR][COLOR=#006610]var[/COLOR] [COLOR=#000050]i[/COLOR][COLOR=#0000ff]=[/COLOR][COLOR=#991010]0[/COLOR]; [COLOR=#000050]i[/COLOR][COLOR=#0000ff]\<[/COLOR][COLOR=#000050]nodes[/COLOR].[COLOR=#0000d0]length[/COLOR]; [COLOR=#000050]i[/COLOR][COLOR=#0000ff]++){[/COLOR] [COLOR=#006610]for[/COLOR] [COLOR=#0000ff]([/COLOR][COLOR=#006610]var[/COLOR] [COLOR=#000050]j[/COLOR][COLOR=#0000ff]=[/COLOR][COLOR=#991010]0[/COLOR]; [COLOR=#000050]j[/COLOR][COLOR=#0000ff]\<[/COLOR][COLOR=#000050]nodes[/COLOR][COLOR=#0000ff][[/COLOR][COLOR=#000050]i[/COLOR][COLOR=#0000ff]][/COLOR].[COLOR=#0000d0]childNodes[/COLOR].[COLOR=#0000d0]length[/COLOR]; [COLOR=#000050]j[/COLOR][COLOR=#0000ff]++){[/COLOR] [COLOR=#000050]currNode[/COLOR] [COLOR=#0000ff]=[/COLOR] [COLOR=#000050]nodes[/COLOR][COLOR=#0000ff][[/COLOR][COLOR=#000050]i[/COLOR][COLOR=#0000ff]][/COLOR].[COLOR=#0000d0]childNodes[/COLOR][COLOR=#0000ff][[/COLOR][COLOR=#000050]j[/COLOR][COLOR=#0000ff]][/COLOR]; [COLOR=#006610]if[/COLOR] [COLOR=#0000ff]([/COLOR][COLOR=#000050]useChildElements[/COLOR].[COLOR=#000050]contains [/COLOR]COLOR=#0000ff){[/COLOR] [COLOR=#006610]if[/COLOR] COLOR=#0000ff{[/COLOR] [COLOR=#000050]results[/COLOR].[COLOR=#0000d0]push[/COLOR]COLOR=#0000ff[/COLOR]; [COLOR=#000050]break[/COLOR];[COLOR=#0000ff]}[/COLOR][COLOR=#0000ff]}[/COLOR][COLOR=#0000ff]}[/COLOR][COLOR=#0000ff]}[/COLOR] [COLOR=#006610]return[/COLOR] [COLOR=#000050]results[/COLOR];[COLOR=#0000ff]}[/COLOR][COLOR=#0000ff][/COLOR] [COLOR=black]I believe the answer may be editing this part but I cannot work out where? If anyone has any solution I would appreciate it.[/COLOR]

Cheers

Chris
