public function QueryPath::xpath in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::xpath()
- 7.2 QueryPath/QueryPath.php \QueryPath::xpath()
File
- QueryPath/
QueryPath.php, line 283
Class
Code
public function xpath($query) {
$xpath = new DOMXPath($this->document);
$found = new SplObjectStorage();
foreach ($this->matches as $item) {
$nl = $xpath
->query($query, $item);
if ($nl->length > 0) {
for ($i = 0; $i < $nl->length; ++$i) {
$found
->attach($nl
->item($i));
}
}
}
$this
->setMatches($found);
return $this;
}