You are here

protected function MigrateListXML::getIDsFromXML in Migrate 6.2

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

Given an XML object, parse out the IDs for processing and return them as an array. The default implementation assumes the IDs are simply the values of the top-level elements - in most cases, you will need to override this to reflect your particular XML structure.

Parameters

SimpleXMLElement $xml:

Return value

array

1 call to MigrateListXML::getIDsFromXML()
MigrateListXML::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 85
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

protected function getIDsFromXML(SimpleXMLElement $xml) {
  $ids = array();
  foreach ($xml as $element) {
    $ids[] = (string) $element;
  }
  return array_unique($ids);
}