public function evaluate($expression, \DOMNode $contextNode = NULL, $registerNodeNS = NULL)
{
$registerNodeNS = NULL === $registerNodeNS ? $this->_registerNodeNamespaces : $registerNodeNS;
return parent::evaluate($expression, $contextNode, (bool) $registerNodeNS);
}
/** * @param \DOMElement $node * @param \stdClass|array $attributes * @param Xpath $xpath * @return array */ private function getNodesArray(\DOMElement $node, $attributes, $xpath) { $result = []; foreach ($attributes as $name => $value) { $child = new \stdClass(); $child->{$name} = $value; $result[] = $child; } foreach ($xpath->evaluate('*|text()[normalize-space(.) != ""]', $node) as $childNode) { /** @var \DOMElement|\DOMText|\DOMCdataSection $childNode */ if ($childNode instanceof \DOMElement) { $child = new \stdClass(); $child->{$childNode->nodeName} = $this->getNodes($childNode); $result[] = $child; } elseif (!$childNode->isWhitespaceInElementContent()) { $result[] = $childNode->nodeValue; } } return $result; }