avoid error when xpath does not find namespace in xml

acer2

New Member
Could someone tell me how to avoid these errors?Testing for existance of namespace?It starts when I want to add geo information to an arrayI thought it was enough to do this.(from the picasa api feed)\[code\]foreach($feed->xpath('//gml:pos') as $pos){$feed_arr['geo'][$i]['pos'] = (string)$pos[0];$i++;}<b>Warning</b>: SimpleXMLElement::xpath() [<a href='http://stackoverflow.com/phpmanual/simplexmlelement.xpath'>simplexmlelement.xpath</a>]: Undefined namespace prefix in <b>/home/woonbel/public_html/tsa.nl/applicatie/lib/gpicasa.class.php</b> on line <b>390</b><br /><br /><b>Warning</b>: SimpleXMLElement::xpath() [<a href='http://stackoverflow.com/phpmanual/simplexmlelement.xpath'>simplexmlelement.xpath</a>]: xmlXPathEval: evaluation failed in <b>/home/woonbel/public_html/tsa.nl/applicatie/lib/gpicasa.class.php</b> on line <b>390</b><br /><br /><b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/woonbel/public_html/tsa.nl/applicatie/lib/gpicasa.class.php</b> on line <b>390</b><br />\[/code\]regards, Richard
 
Back
Top