public function QueryPath::children in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::children()
- 7.2 QueryPath/QueryPath.php \QueryPath::children()
File
- QueryPath/
QueryPath.php, line 1024
Class
Code
public function children($selector = NULL) {
$found = new SplObjectStorage();
foreach ($this->matches as $m) {
foreach ($m->childNodes as $c) {
if ($c->nodeType == XML_ELEMENT_NODE) {
$found
->attach($c);
}
}
}
if (empty($selector)) {
$this
->setMatches($found);
}
else {
$this->matches = $found;
$this
->filter($selector);
}
return $this;
}