You are here

protected function Xml::predicateMatches in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/migrate_plus/data_parser/Xml.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Xml::predicateMatches()
  2. 8.2 src/Plugin/migrate_plus/data_parser/Xml.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Xml::predicateMatches()
  3. 8.3 src/Plugin/migrate_plus/data_parser/Xml.php \Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Xml::predicateMatches()

Tests whether the iterator's xpath predicate matches the provided element.

Has some limitations esp. in that it is easy to write predicates that reference things outside this SimpleXmlElement's tree, but "simpler" predicates should work as expected.

Parameters

\SimpleXMLElement $elem: The element to test.

Return value

bool True if the element matches the predicate, false if not.

1 call to Xml::predicateMatches()
Xml::fetchNextRow in src/Plugin/migrate_plus/data_parser/Xml.php
Retrieves the next row of data. populating currentItem.

File

src/Plugin/migrate_plus/data_parser/Xml.php, line 282

Class

Xml
Obtain XML data for migration using the XMLReader pull parser.

Namespace

Drupal\migrate_plus\Plugin\migrate_plus\data_parser

Code

protected function predicateMatches(\SimpleXMLElement $elem) {
  return !empty($elem
    ->xpath('/*[' . $this->xpathPredicate . ']'));
}