Parsing Complex XML Document using PHP xPath

Xendran

New Member
I have an XML Structure, like I have outline below. I am trying to use xPath to find particular elements within the structure, but have been unsuccessful. This is what I have thus far:$resultset[0]['bibXML'] - Here is a paste of exactly what is being passed in this variable. http://pastebin.com/CwtFG5djHere is a link to the output of the $myNode using print_r().http://pastebin.com/TwDaxs42\[code\]$myNode = new SimpleXMLElement($resultset[0]['bibXML']);$bnum = $myNode->xpath("record/datafield[@tag='035']/subfield[@code='a']");<record> <leader>01220nam 2200265 4500</leader> <controlfield tag="001">ocm00000197</controlfield> <datafield tag="035" ind1="" ind2=""> <subfield code="a">.b10000021</subfield> <subfield code="b">a </subfield> <subfield code="c">-</subfield> </datafield> <datafield tag="245" ind1="" ind2=""> <subfield code="a">Some Book Title</subfield> <subfield code="b">a </subfield> <subfield code="c">-</subfield> </datafield></record>\[/code\]
 
Back
Top