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.
SimpleXML Extension ” 117<br />
Comparing N o d e s<br />
T ocompare an element or attribute <strong>with</strong> a string value, you must first explicitly cast<br />
it <strong>to</strong> a string. Otherwise, it will be treated as an object, which may causes type issues<br />
including emitting errors.<br />
<br />
DOM I n t e r o p e r a b i l i t y<br />
With both the DOM and SimpleXML extensions being tree parsers, this allows for a<br />
certain degree of interoperability between the two. This can be handy if you prefer<br />
one o v e r the other when refac<strong>to</strong>ring legacy code or if you have use cases for both<br />
<strong>with</strong>in a single application.<br />
<br />
XPath<br />
Like the DOM extension, SimpleXML also supports XPath. Rather than using a separate<br />
class for it as the DOM does, the SimpleXMLElement class itself includes a method<br />
for it. Where the query() and evaluate() methods of the DOMXPath class return a<br />
DOMNodeList instance, the xpath method of SimpleXMLElement instead returns an enumerated<br />
array of SimpleXMLElement instances that match the given XPath expression.