You are here

protected function MigrateItemsXML::getIDsFromXML in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 plugins/sources/xml.inc \MigrateItemsXML::getIDsFromXML()
2 calls to MigrateItemsXML::getIDsFromXML()
MigrateItemsXML::computeCount in plugins/sources/xml.inc
Return a count of all available IDs from the source listing.
MigrateItemsXML::getIdList in plugins/sources/xml.inc
Load the XML at the given URL, and return an array of the IDs found within it.

File

plugins/sources/xml.inc, line 438
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

protected function getIDsFromXML(SimpleXMLElement $xml, $refresh = FALSE) {
  if ($refresh !== TRUE && $this->cache_ids != NULL) {
    return $this->cache_ids;
  }
  $this->cache_ids = NULL;
  $result = $xml
    ->xpath($this->itemXpath);
  $ids = array();
  if ($result) {
    foreach ($result as $element) {
      $id = $this
        ->getItemID($element);
      if (!is_null($id)) {
        $ids[] = (string) $id;
      }
    }
  }
  $this->cache_ids = array_unique($ids);
  return $this->cache_ids;
}