You are here

protected function Xml::getXpath in Views XML Backend 8

Returns the XPath object for this query.

Parameters

string $contents: The XML file contents.

Return value

\DOMXPath An XPath object.

1 call to Xml::getXpath()
Xml::doExecute in src/Plugin/views/query/Xml.php
Performs the actual view execution.

File

src/Plugin/views/query/Xml.php, line 495
Contains \Drupal\views_xml_backend\Plugin\views\query\Xml.

Class

Xml
Views query plugin for an XML query.

Namespace

Drupal\views_xml_backend\Plugin\views\query

Code

protected function getXpath($contents) {
  if ($contents === '') {
    return new \DOMXPath(new \DOMDocument());
  }
  $xpath = new \DOMXPath($this
    ->createDomDocument($contents));
  $this
    ->registerNamespaces($xpath);
  $xpath
    ->registerPhpFunctions('views_xml_backend_date');
  $xpath
    ->registerPhpFunctions('views_xml_backend_format_value');
  return $xpath;
}