PDA

View Full Version : Data from an array problem


Gbright
01-16-2003, 12:23 PM
I'm parsing an XML page into a PHP array, and after a bit of research into this (I'm new to XML and just starting to pick it up, but needed a solution very quickly), I've got all the data in an array.

The XML file is laid out like this :

<level1>
<data1>
<data2>
<data3>
<level2 date="01/14/2003">
<data4>
<data5>
</level2>
<level2 date="01/15/2003">
<data4>
<data5>
</level2>
</level1>


I can display the data in the <level1> layer (ie <level1><data1>, but I can't get the data4 and 5 stuff...I've tried some tutorial xml files that I can get 2nd level data from, but they don't have an attribute on the tag. The problem seems to me to be the date attribute.

I've used an array display function that shows me the names of the levels, and it does show the array name as <level1><01/14/2003><data4>, but it won't display the info. Surely if the name of the level is named after the xml attribute, it should let me see that info...

I've been looking at this and trying different combinations of code to get the data that I think I can't 'see the wood for the trees' anymore.

I would be very grateful if you could shed some light on this for me...(it's probably the simplest thing that I'll be kicking myself over)

Thanks

Gbright
01-16-2003, 03:08 PM
nevermind, I had a look at a different parser, and it's labelled the tags a lot better.

thanks