public function MigrateSourceXML::getNextRow in Migrate 7.2
Same name and namespace in other branches
- 6.2 plugins/sources/xml.inc \MigrateSourceXML::getNextRow()
Implementation of MigrationSource::getNextRow().
Return value
stdClass data for the next row from the XML source files
File
- plugins/
sources/ xml.inc, line 1319 - Support for migration from XML sources.
Class
- MigrateSourceXML
- Implementation of MigrateSource, to handle imports from XML files.
Code
public function getNextRow() {
migrate_instrument_start('MigrateSourceXML::next');
$source_key = $this->activeMap
->getSourceKey();
$key_name = key($source_key);
$row = NULL;
// The reader is now lazy loaded, so it may
// not be defined yet, need to test if set.
if (isset($this->reader)) {
// Attempt to load the next row.
$this->reader
->next();
}
// Test the reader for a valid row.
if (isset($this->reader) && $this->reader
->valid()) {
$row = new stdClass();
$row->{$key_name} = $this->reader
->key();
$row->xml = $this->reader
->current();
$this
->registerNamespaces($row->xml);
}
else {
// The current source is at the end, try to load the next source.
if ($this
->getNextSource()) {
$row = new stdClass();
$row->{$key_name} = $this->reader
->key();
$row->xml = $this->reader
->current();
$this
->registerNamespaces($row->xml);
}
}
migrate_instrument_stop('MigrateSourceXML::next');
return $row;
}