# XML to array problems. Help!

**URL:** <https://forum.kirupa.com/t/xml-to-array-problems-help/75852>\
**Category:** flash\
**Created:** [January 12, 2005, 5:32pm UTC](https://forum.kirupa.com/t/xml-to-array-problems-help/75852 "2005-01-12T17:32:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iselsewhere](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@iselsewhere](https://forum.kirupa.com/u/iselsewhere)\
**Post date:** [January 12, 2005, 5:32pm UTC](https://forum.kirupa.com/t/xml-to-array-problems-help/75852/1 "2005-01-12T17:32:29Z")

</div>

I’m a newbie at XML and I’m trying to make my portfolio XML-driven. What I’m trying to do is similiar to a photogallery. The difference is that I want “sub pictures” to every item in the gallery. Example: If I click on a project name in the portfolio an image should appear. Then I want to be able to browse between different images _within_ that project. When I click on a another project a different set of pictures will be loaded.

My XML file looks as exemplified below. What I’m having troubles figuring out how to do is getting the array right.

I want to access the data something like this:

imageArray[0].path[1] would return “[http://www.pic.com/picA1.jpg](http://www.pic.com/picA1.jpg)”  
imageArray[0].title returns “Title A”

I fail to parse the XML into an multidimensional array like this… Please help me to do this in the easiest way!

\<images\>[indent]\<item title=“Title A”\>[indent]\<pic path=“[http://www.pic.com/picA1.jpg](http://www.pic.com/picA1.jpg)”\>

\<desc\>First A picture\</desc\>  
\</pic\>

\<pic path=“[http://www.pic.com/picA1.jpg](http://www.pic.com/picA1.jpg)”\>  
\<desc\>Second A picture\</desc\>  
\</pic\>

[/indent]\</item\>

\<item title=“Title B”\>[indent]\<pic path=“[http://www.pic.com/picB1.jpg](http://www.pic.com/picB1.jpg)”\>

\<desc\>First B picture\</desc\>  
\</pic\>

\<pic path=“[http://www.pic.com/picB2.jpg](http://www.pic.com/picB2.jpg)”\>  
\<desc\>Second B picture\</desc\>  
\</pic\>

[/indent]\</item\>

…and so on

[/indent]
