Unions
When addressing nodes, it is possible to perform a single query that uses multiple expressions. This is referred to as addressing the union of those expressions.
<?php
// Returns the li child nodes of all ul and ol nodes
$list = $xpath->query('//ol/li|//ul/li');
// Returns the th and td nodes of all tr nodes
$list = $xpath->query('//tr/th|//tr/td');
?>
© DOM Extension — Web Scraping >>> Back to TABLE OF CONTENTS <<< | |
| Views: 412 | |
| Total comments: 0 | |