I am trying to get to the geo information off the google-picasa API. This is the original XML:
35
echo $geo->pos[0];
You could work with XPath and registerXPathNamespace():
$xml->registerXPathNamespace("georss", "http://www.georss.org/georss");
$xml->registerXPathNamespace("gml", "http://www.opengis.net/gml");
$pos = $xml->xpath("/georss:where/gml:Point/gml:pos");
From the docs, emphasis mine:
registerXPathNamespace […] Creates a prefix/ns context for the next XPath query.
More ways to handle namespaces in SimpleXML can be found here, for example:
Stuart Herbert On PHP - Using SimpleXML To Parse RSS Feeds
This is how I did it without using xpath:
$georss = $photo->children('http://www.georss.org/georss');
$coords;
if($georss->count()>0) {
$gml = $georss->children('http://www.opengis.net/gml');
if($gml->count()>0) {
if(isset($gml->Point->pos)) {
$coords = $gml->Point->pos;
}
}
}