public function MigrateSourceXML::__construct in Migrate 6.2
Same name and namespace in other branches
- 7.2 plugins/sources/xml.inc \MigrateSourceXML::__construct()
Source constructor.
Parameters
string or array $url: URL(s) of the XML source data.
string $element_query: Query string used to recognize elements being iterated.
string $id_query: Xpath query string used to retrieve the primary key value from each element.
array $fields: Optional - keys are field names, values are descriptions. Use to override the default descriptions, or to add additional source fields which the migration will add via other means (e.g., prepareRow()).
boolean $options: Options applied to this source. In addition to the standard MigrateSource options, we support:
- reader_class: The reader class to instantiate for traversing the XML - defaults to MigrateXMLReader (any substitutions must be derived from MigrateXMLReader).
Overrides MigrateSource::__construct
File
- plugins/
sources/ xml.inc, line 891 - Support for migration from XML sources.
Class
- MigrateSourceXML
- Implementation of MigrateSource, to handle imports from XML files.
Code
public function __construct($urls, $element_query, $id_query, array $fields = array(), array $options = array()) {
parent::__construct($options);
if (empty($options['reader_class'])) {
$reader_class = 'MigrateXMLReader';
}
else {
$reader_class = $options['reader_class'];
}
if (!is_array($urls)) {
$urls = array(
$urls,
);
}
$this->sourceUrls = $urls;
$this->activeUrl = NULL;
$this->elementQuery = $element_query;
$this->idQuery = $id_query;
$this->readerClass = $reader_class;
$this->fields = $fields;
}