You are here

public function XpathDomXpath::evaluate in Feeds extensible parsers 8

Evaluates the XPath expression and returns a typed result if possible.

Parameters

string $expression: The XPath expression to execute.

\DOMNode $context_node: (optional) The optional contextnode can be specified for doing relative XPath queries. Defaults to the root element.

See also

DOMXPath::evaluate()

File

src/XpathDomXpath.php, line 57

Class

XpathDomXpath
Wraps DOMXPath simplifying usage.

Namespace

Drupal\feeds_ex

Code

public function evaluate($expression, DOMNode $context_node = NULL) {
  if ($context_node === NULL) {
    $context_node = $this->xpath->document;
  }
  return $this->xpath
    ->evaluate($expression, $context_node);
}