XPath xml ad bulmak değil zaman hatayı önlemek

0 Cevap php

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 array I thought it was enough to do this.

(Picasa API yem)

foreach($feed->xpath('//gml:pos') as $pos)
{

$feed_arr['geo'][$i]['pos'] = (string)$pos[0];
$i++;
}

<b>Warning</b>:  SimpleXMLElement::xpath() [<a href='/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='/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 />

Saygılarımızla, Richard

0 Cevap