Reading Hierarchial XML elements in PHP
Posted: Thu Aug 13, 2009 2:55 pm
I'm trying to get my PHP to read a list of items from an XML file in the format of:
Such that I have nested <item> tags. I'm new to XPath and have found it to be useful for getting data like this, but for some reason seems to only produce one result with the contents of all of the combined tags.
Any advice would be useful.
Code: Select all
<item identifier="ITEM-eXeed_rigging44f81a2d1cb8e8ff933" isvisible="true" identifierref="RES-eXeed_rigging44f81a2d1cb8e8ff934">
<title>Advanced Rigging</title>
<item identifier="ITEM-eXeed_rigging44f81a2d1cb8e8ff935" isvisible="true" identifierref="RES-eXeed_rigging44f81a2d1cb8e8ff936">
<title>Chapter 1</title>
</item>
<item identifier="ITEM-eXeed_rigging44f81a2d1cb8e8ff937" isvisible="true" identifierref="RES-eXeed_rigging44f81a2d1cb8e8ff938">
<title>Chapter 2</title>
</item>
</item>Code: Select all
$elements = $xpath->query('m:item');Any advice would be useful.