protected function Xml::getSimpleXml in Migrate Plus 8.3
Same name and namespace in other branches
- 8.5 src/Plugin/migrate_plus/data_parser/Xml.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Xml::getSimpleXml()
- 8.2 src/Plugin/migrate_plus/data_parser/Xml.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Xml::getSimpleXml()
- 8.4 src/Plugin/migrate_plus/data_parser/Xml.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Xml::getSimpleXml()
Builds a \SimpleXmlElement rooted at the iterator's current location.
The resulting SimpleXmlElement also contains any child nodes of the current element.
Return value
\SimpleXmlElement|false A \SimpleXmlElement when the document is parseable, or false if a parsing error occurred.
Throws
1 call to Xml::getSimpleXml()
- Xml::fetchNextRow in src/Plugin/ migrate_plus/ data_parser/ Xml.php 
- Retrieves the next row of data from the open source URL, populating currentItem.
File
- src/Plugin/ migrate_plus/ data_parser/ Xml.php, line 140 
Class
- Xml
- Obtain XML data for migration using the XMLReader pull parser.
Namespace
Drupal\migrate_plus\Plugin\migrate_plus\data_parserCode
protected function getSimpleXml() {
  $node = $this->reader
    ->expand();
  if ($node) {
    // We must associate the DOMNode with a DOMDocument to be able to import
    // it into SimpleXML. Despite appearances, this is almost twice as fast as
    // simplexml_load_string($this->readOuterXML());
    $dom = new \DOMDocument();
    $node = $dom
      ->importNode($node, TRUE);
    $dom
      ->appendChild($node);
    $sxml_elem = simplexml_import_dom($node);
    $this
      ->registerNamespaces($sxml_elem);
    return $sxml_elem;
  }
  else {
    foreach (libxml_get_errors() as $error) {
      $error_string = self::parseLibXmlError($error);
      throw new MigrateException($error_string);
    }
    return FALSE;
  }
}