You are here

public function MigrateXMLReader::rewind in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/xml.inc \MigrateXMLReader::rewind()

Implementation of Iterator::rewind().

File

plugins/sources/xml.inc, line 998
Support for migration from XML sources.

Class

MigrateXMLReader
Makes an XMLReader object iterable, returning elements matching a restricted xpath-like syntax.

Code

public function rewind() {

  // (Re)open the provided URL.
  $this->reader
    ->close();
  $status = $this->reader
    ->open($this->url, NULL, LIBXML_NOWARNING);

  // Reset our path tracker.
  $this->currentPath = array();
  if ($status) {

    // Load the first matching element and its ID.
    $this
      ->next();
  }
  else {
    Migration::displayMessage(t('Could not open XML file !url', array(
      '!url' => $this->url,
    )));
  }
}