You are here

public function MigrateListXML::getIdList in Migrate 7.2

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

Load the XML at the given URL, and return an array of the IDs found within it.

Overrides MigrateList::getIdList

File

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

Class

MigrateListXML
Implementation of MigrateList, for retrieving a list of IDs to be migrated from an XML document.

Code

public function getIdList() {
  migrate_instrument_start("Retrieve {$this->listUrl}");
  $xml = simplexml_load_file($this->listUrl);
  migrate_instrument_stop("Retrieve {$this->listUrl}");
  if ($xml !== FALSE) {
    $this
      ->registerNamespaces($xml);
    return $this
      ->getIDsFromXML($xml);
  }
  else {
    Migration::displayMessage(t('Loading of !listUrl failed:', array(
      '!listUrl' => $this->listUrl,
    )));
    foreach (libxml_get_errors() as $error) {
      Migration::displayMessage(MigrateItemsXML::parseLibXMLError($error));
    }
    return NULL;
  }
}