Jump to content

xml and xpath


dexhaven

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.