protected function DOMXPath::addDefaultNamespace in Feeds XPath Parser 8
Normalizes XPath queries, adding the default namespace.
Parameters
string $query: An XPath query string
Overrides DOMXPath::addDefaultNamespace
1 call to DOMXPath::addDefaultNamespace()
- DOMXPath::namespacedQuery in lib/
Drupal/ feeds_xpathparser/ DOMXPath.php - Executes an XPath query with namespace support.
1 method overrides DOMXPath::addDefaultNamespace()
- DOMXPath::addDefaultNamespace in lib/
Drupal/ feeds_xpathparser/ DOMXPath.php - Normalizes XPath queries, adding the default namespace.
File
- lib/
Drupal/ feeds_xpathparser/ DOMXPath.php, line 167 - Contains \Druapl\feeds_xpathparser\DOMXPath.
Class
- DOMXPath
- Wraps DOMXPath providing enhanced debugging and special namespace handling.
Namespace
Drupal\feeds_xpathparserCode
protected function addDefaultNamespace(&$query) {
foreach ($this->namespaces as $prefix => $namespace) {
if ($prefix === '') {
$this
->registerNamespace('__default__', $namespace);
// Replace all the elements without prefix by the default prefix.
if (!isset($this->modifiedQueries[$query])) {
$parser = new XPathQueryParser($query);
$mod_query = $parser
->getQuery();
$this->modifiedQueries[$query] = $mod_query;
$query = $mod_query;
}
else {
$query = $this->modifiedQueries[$query];
}
}
else {
$this
->registerNamespace($prefix, $namespace);
}
}
}