News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Thomas Weinert's Blog:
Using PHP DOM With XPath
April 13, 2010 @ 13:18:32

Thomas Weinert has a recent post to his blog showing how to use one of the more powerful XML-handling features that PHP's DOM extension includes - XPath.

Often I hear people say "We use SimpleXML, because DOM is so noisy and complex". Well, I don't think so. This article explains how you can parse a XML (an Atom feed) using the PHP DOM extension. No other libraries are involved.

In his example he loads an external feed (his own) into a DOM object, blocks any errors with a few handy functions and creates a DOMXPath object on the DOM object to get ready for his queries. He shows how to make searches for titles, subtitles, looping over attributes and an element list returned from one of the first queries. A full code listing is also provided to show how it all fits together.

0 comments voice your opinion now!
dom xpath domxpath tutorial search atom


blog comments powered by Disqus

Similar Posts

Abhinav Singh's Blog: Setting Nginx, PHP Fastcgi and XCache on a new Ubuntu

Pathfinder Blog: PHP Spam Injection First Aid with Apache ModSecurity

DeveloperTutorials.com: Writing A Simple Twitter Client Using the PHP Zend Framework's OAuth Library

Manuel Pichler's Blog: PHP_Depend jumps on the D-BUS

DevShed: Getting PHP to Talk to MySQL


Community Events





Don't see your event here?
Let us know!


threedevsandamaybe community install list symfony application release wordpress configure language api code interview podcast library developer series bugfix introduction laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework