News Feed
Jobs Feed
Sections




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

Fabien Potencier's Blog:
Parsing XML documents with CSS selectors
April 02, 2010 @ 09:41:27

In a new post Fabien Potencier talks about how he took the Python lxml.cssselect component from Python, ported it over to PHP and made a library that allows you to parse XML with the handy CSS selectors rather than using XPath.

Odds are you [also] need to parse some from time to time: because you consume a web service and want to extract some information, or because you want to gather data from scraped web pages, or just because you want to write functional tests for a website.

The CssSelector tool allows you to convert a CSS selector into an XPath that can, in turn, be pushed into the XPath function of the PHP DOM XML functionality. He gives a few examples of using it for a simple "find" and for something more complex involving a SimpleXML object too.

The library can be downloaded from github here.

0 comments voice your opinion now!
xml parse css selector cssselector tutorial


blog comments powered by Disqus

Similar Posts

PHPMaster.com: ClamAV as a Validation Filter in Zend Framework

IBM developerWorks: U2 PDO Driver Tutorial, Parts 1 & 2

MaltBlue.com: Zend Form Mastery with Zend Config - Part 4 Configuring Zend Validators

NETTUTS.com: Online File Storage with PHP

Ryan Grove's Blog: Minify combines, minifies &caches JavaScript & CSS files to speed up page loads


Community Events











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


introduction component series security symfony2 composer framework application release package language podcast facebook hack code opinion example hhvm unittest install

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