You are here

protected function XmlTrait::registerNamespaces in Migrate Plus 8.2

Same name and namespace in other branches
  1. 8.5 src/Plugin/migrate_plus/data_parser/XmlTrait.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\XmlTrait::registerNamespaces()
  2. 8.3 src/Plugin/migrate_plus/data_parser/XmlTrait.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\XmlTrait::registerNamespaces()
  3. 8.4 src/Plugin/migrate_plus/data_parser/XmlTrait.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\XmlTrait::registerNamespaces()

Registers the iterator's namespaces to a SimpleXMLElement.

Parameters

\SimpleXMLElement $xml: The element to apply namespace registrations to.

2 calls to XmlTrait::registerNamespaces()
SimpleXml::openSourceUrl in src/Plugin/migrate_plus/data_parser/SimpleXml.php
Opens the specified URL.
Xml::getSimpleXml in src/Plugin/migrate_plus/data_parser/Xml.php
Builds a \SimpleXmlElement rooted at the iterator's current location.

File

src/Plugin/migrate_plus/data_parser/XmlTrait.php, line 16

Class

XmlTrait
Common functionality for XML data parsers.

Namespace

Drupal\migrate_plus\Plugin\migrate_plus\data_parser

Code

protected function registerNamespaces(\SimpleXMLElement $xml) {
  if (isset($this->configuration['namespaces']) && is_array($this->configuration['namespaces'])) {
    foreach ($this->configuration['namespaces'] as $prefix => $ns) {
      $xml
        ->registerXPathNamespace($prefix, $ns);
    }
  }
}