public function MigrateItemsXML::getItemsFromXML in Migrate 6.2
Same name and namespace in other branches
- 7.2 plugins/sources/xml.inc \MigrateItemsXML::getItemsFromXML()
1 call to MigrateItemsXML::getItemsFromXML()
- MigrateItemsXML::getAllItems in plugins/
sources/ xml.inc - Load the XML at the given URL, and return an array of the Items found within it.
File
- plugins/
sources/ xml.inc, line 502 - 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 getItemsFromXML(SimpleXMLElement $xml, $refresh = FALSE) {
if ($refresh !== FALSE && $this->cache_items != NULL) {
return $this->cache_items;
}
$this->cache_items = NULL;
$items = array();
$result = $xml
->xpath($this->itemXpath);
if ($result) {
foreach ($result as $item_xml) {
$id = $this
->getItemID($item_xml);
$item = new stdclass();
$item->xml = $item_xml;
$items[$id] = $item;
}
$this->cache_items = $items;
return $items;
}
else {
return NULL;
}
}