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”
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”>
<desc>First A picture</desc>
</pic>
<pic path=“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”>
<desc>First B picture</desc>
</pic>
<pic path=“http://www.pic.com/picB2.jpg”>
<desc>Second B picture</desc>
</pic>
[/indent]</item>
…and so on
[/indent]