K
KDawg44
Hi,
I am getting some XML from an AJAX call and want to load it into a 2D
associative array.
For example, if my XML looks like this:
<XMLData>
<Item1>
<ItemName>Name1</ItemName>
<ItemDesc>Desc1</Desc>
<ImagePath>image1.jpg</ImagePath>
<Blah>asdf1</blah>
</Item1>
<Item2>
<ItemName>Name2</ItemName>
<ItemDesc>Desc2</Desc>
<ImagePath>image2.jpg</ImagePath>
<Blah>asdf2</blah>
</Item2>
.....
<ItemN>
<ItemName>NameN</ItemName>
<ItemDesc>DescN</Desc>
<ImagePath>imageN.jpg</ImagePath>
<Blah>asdfN</blah>
</Item1>
</XMLData>
I want to load it into an Associative Array like this:
array(ItemN, array(ItemName, NameN))
What is the easiest way to do this? I need to easily be able to
access various pieces in no particular order and access different
pieces of that so I need to get all the XML into the array and be able
to easily call to a specific item like itemName = array(Item14,
(ItemName))
I figured getting the data into the array would be the best way.
Thanks.
Kevin
I am getting some XML from an AJAX call and want to load it into a 2D
associative array.
For example, if my XML looks like this:
<XMLData>
<Item1>
<ItemName>Name1</ItemName>
<ItemDesc>Desc1</Desc>
<ImagePath>image1.jpg</ImagePath>
<Blah>asdf1</blah>
</Item1>
<Item2>
<ItemName>Name2</ItemName>
<ItemDesc>Desc2</Desc>
<ImagePath>image2.jpg</ImagePath>
<Blah>asdf2</blah>
</Item2>
.....
<ItemN>
<ItemName>NameN</ItemName>
<ItemDesc>DescN</Desc>
<ImagePath>imageN.jpg</ImagePath>
<Blah>asdfN</blah>
</Item1>
</XMLData>
I want to load it into an Associative Array like this:
array(ItemN, array(ItemName, NameN))
What is the easiest way to do this? I need to easily be able to
access various pieces in no particular order and access different
pieces of that so I need to get all the XML into the array and be able
to easily call to a specific item like itemName = array(Item14,
(ItemName))
I figured getting the data into the array would be the best way.
Thanks.
Kevin