public function QueryPathCssEventHandler::elementNS in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::elementNS()
- 7.2 QueryPath/CssEventHandler.php \QueryPathCssEventHandler::elementNS()
Overrides CssEventHandler::elementNS
File
- QueryPath/
CssEventHandler.php, line 121
Class
Code
public function elementNS($lname, $namespace = NULL) {
$this->findAnyElement = FALSE;
$found = new SplObjectStorage();
$matches = $this
->candidateList();
foreach ($matches as $item) {
$nsuri = $this->dom
->lookupNamespaceURI($namespace);
if ($item instanceof DOMNode && $item->namespaceURI == $nsuri && $lname == $item->localName) {
$found
->attach($item);
}
if (!empty($nsuri)) {
$nl = $item
->getElementsByTagNameNS($nsuri, $lname);
if (!empty($nl)) {
$this
->attachNodeList($nl, $found);
}
}
else {
$nl = $item
->getElementsByTagName($lname);
$tagname = $namespace . ':' . $lname;
$nsmatches = array();
foreach ($nl as $node) {
if ($node->tagName == $tagname) {
$found
->attach($node);
}
}
}
}
$this->matches = $found;
}