php|architect's Guide to Web Scraping with PHP - Wind Business ...
php|architect's Guide to Web Scraping with PHP - Wind Business ...
php|architect's Guide to Web Scraping with PHP - Wind Business ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
140 ” CSS Selec<strong>to</strong>r Libraries<br />
U n l i k ethe others, however, it does not implement a CSS selec<strong>to</strong>r parser in order<br />
<strong>to</strong> offer related functionality. Instead, it does so programmatically through its API.<br />
F o r example, rather than passing the name of an element (say div) <strong>to</strong> a central query<br />
method, an element() method accepts the name of an element for which <strong>to</strong> query.<br />
Though this makes it a bit less concise than other libraries, it also makes it more<br />
expressive and only requires a basic knowledge of DOM concepts in order <strong>to</strong> operate<br />
it.<br />
It can be downloaded at http://github.com/elazar/domquery/tree/master. The<br />
central class DOMQuery is documented using phpDoc-compatible API docblocks and<br />
the unit test suite offers use cases for each of the available methods.<br />
W r a p - U p<br />
This concludes the current chapter. Y o should u come away from reading it <strong>with</strong><br />
knowledge of the pros and cons of using CSS selec<strong>to</strong>r-based libraries and situations<br />
where their use is appropriate, specific CSS selec<strong>to</strong>rs and possible equivalents for<br />
them in XPath, and particular library implementations <strong>to</strong> consider.