# XML parent problem !Urgent

**URL:** <https://forum.kirupa.com/t/xml-parent-problem-urgent/175415>\
**Category:** flash\
**Created:** [January 14, 2006, 4:10am UTC](https://forum.kirupa.com/t/xml-parent-problem-urgent/175415 "2006-01-14T04:10:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![novocaine](https://avatars.discourse-cdn.com/v4/letter/n/7993a0/32.png) [@novocaine](https://forum.kirupa.com/u/novocaine)\
**Post date:** [January 14, 2006, 4:10am UTC](https://forum.kirupa.com/t/xml-parent-problem-urgent/175415/1 "2006-01-14T04:10:53Z")

</div>

Hi,

I am making a dynamic image gallery, for this i am using XML and Flash mx 2004. Here is my problem:

My XML structure is as follows:  
…  
\<gallery\>  
\<collection1\>  
\<collectionname\>Summer 2005\</collectionname\>  
\<images\>  
\<itm\>  
\<thumb\>images/gallery/1/thumbs/1\</thumb\>  
\<big\>images/gallery/1/1.jpg\</big\>  
\</itm\>  
\</images\>  
\</collection\>  
…another collection named collection2  
…another collection named collection3  
…  
\</gallery\>  
…

I use a node finding function:

function findNode(node, nodeName)  
{  
if (node.nodeName==nodeName)  
return node;  
for (var i=0; node.childNodes && i\<node.childNodes.length; i++)  
{  
var foundNode=findNode(node.childNodes\*, nodeName);  
if (foundNode!=null)  
return foundNode;  
}  
return null;  
}

//got it from somewhere and it worked fine in the past

I am trying this: i need to find a collection by it’s name (collection1, collection2…) and then go to the images node and read the datas there, the items.

this is the AS i use

* * *

searchItem = “collection”+\_root.colid;  
var current\_collectionID= findNode(rootNode,searchItem);

(rootNode is declared correct before)  
It seems that this doesn’t work ☹  
i can’t access current\_collectionID.childNodes[0] for example to read the name or childNodes[1] to acces the images i need.

I can’t attach the fla, it’s rather huge (this is just a small part of a website i am working on)

I hope you can help me.  
Thanks
