dexhaven Posted February 3, 2007 Share Posted February 3, 2007 I have this xml document root node: <EventData objectID="ca3d3b53-f880-4000-ac2b-616982215a02" defaultOID="92a368c2-d96a-47a9-913a-a688fcab29df" xmlns="urn://www.nowhere.com/events.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> I want to use the xpath expression: /EventData[@defaultOID] to get the defaultOID. How do I do it? I think I have gotten this far, but don't know where to go from here: $xpath = new DOMXPath($xmlDocEventData); $xpath->registerNamespace("p", "urn://www.nowhere.com/events.xsd"); $query = '/p:EventData[@defaultOID]'; $entries = $xpath->query($query, $xmlDocEventData); What do I do with the $entries? Link to comment https://forums.phpfreaks.com/topic/36881-xml-and-xpath/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.