You are here

public function MigrateItemsXML::xml in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/xml.inc \MigrateItemsXML::xml()

Load and return the xml from currentUrl.

Return value

SimpleXMLElement SimpleXMLElement

2 calls to MigrateItemsXML::xml()
MigrateItemsXML::getAllItems in plugins/sources/xml.inc
Load the XML at the given URL, and return an array.
MigrateItemsXML::getIdList in plugins/sources/xml.inc
Load ID's from URLs.

File

plugins/sources/xml.inc, line 557
Support for migration from XML sources.

Class

MigrateItemsXML
Implementation of MigrateItems, for providing a list of IDs and for retrieving a parsed XML document given an ID from this list.

Code

public function &xml() {
  if (!empty($this->currentUrl)) {
    $this->currentXml = simplexml_load_file($this->currentUrl);
    if ($this->currentXml === FALSE) {
      Migration::displayMessage(t('Loading of !currentUrl failed:', array(
        '!currentUrl' => $this->currentUrl,
      )));
      foreach (libxml_get_errors() as $error) {
        Migration::displayMessage(self::parseLibXMLError($error));
      }
    }
    else {
      $this
        ->registerNamespaces($this->currentXml);
    }
  }
  return $this->currentXml;
}