There's lots of these questions, so forgive me. I've read them all.
I have the following XML document using the namespace http://www.columbasystems.com/cpng/xmlviewer/cal/1-0/ : http://events.manchester.ac.uk/f3vf/calendar/tag:manchester_museum/view:list/p:q_details/calml.xml
I'm attempting to parse this document using SimpleXML. The example code below is an attempt at accessing the value of the title node "Discovery Center" from the below.
<ns:calendar xmlns:ns="http://www.columbasystems.com/cpng/xmlviewer/cal/1-0/">
<ns:listView>
<ns:day date="2015-07-08" weekDay="Wed">
<ns:event>
<ns:id xmlns:even="http://www.columbasystems.com/customers/uom/gpp/eventid/" query="{http://www.columbasystems.com/customers/uom/gpp/eventid/}b9v-ib270yqf-nmn54k">even:b9v-ib270yqf-nmn54k</ns:id>
<ns:title>Discovery Centre</ns:title>
...
</ns:event>
</ns:day>
</ns:listView>
</ns:calendar>
PHP :
$feed_uri = 'http://events.manchester.ac.uk/f3vf/calendar/tag:manchester_museum/view:list/p:q_details/calml.xml';
$xml = simplexml_load_file($feed_uri);
$xml->registerXPathNamespace("ns", "http://www.columbasystems.com/cpng/xmlviewer/cal/1-0/");
foreach($xml->xpath('//ns:calendar/ns:listView/ns:day') as $day) {
$events = $day->xpath('//ns:event');
foreach($events as $event) {
var_export($event->xpath('//ns:title'));
}
}
OUTPUTS several empty arrays:
array ( 0 => SimpleXMLElement::__set_state(array( )),
I think i'm using xpath wrong, how do i get to the values of nodes like these?