Reply to Re: SimpleXML and xpath woes

Your name:

Reply:


Posted by Simon Turvey on 03/17/05 14:47

Rob Richards kindly sent me the following response via email - posting it here as he's not subscribed.

>
> You need to register a namespace for XPath since there's a default
> namesapce.
>
> $xml = simplexml_load_file('test.xml');
> /* Register arbitrary namesapce prefix for xpath*/
> $xml->registerXPathNamespace('p',
> 'http://webservices.amazon.com/AWSECommerceService/2005-02-23');
> $query = '//p:ItemLookupResponse';
> $result = $xml->xpath($query);
> var_dump($result);

Just to add to this: the registerXPathNamespace method is only present in CVS/snapshot builds and is
scheduled for the 5.1 release.

Cheers,

Simon

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация