You are here

protected function XmlParser::executeContext in Feeds extensible parsers 8

Returns rows to be parsed.

Parameters

\Drupal\feeds\FeedInterface $feed: Source information.

\Drupal\feeds\Result\FetcherResultInterface $fetcher_result: The result returned by the fetcher.

\Drupal\feeds\StateInterface $state: The state object.

Return value

array|Traversable Some iterable that returns rows.

Overrides ParserBase::executeContext

1 method overrides XmlParser::executeContext()
QueryPathXmlParser::executeContext in src/Feeds/Parser/QueryPathXmlParser.php
Returns rows to be parsed.

File

src/Feeds/Parser/XmlParser.php, line 119

Class

XmlParser
Defines a XML parser using XPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function executeContext(FeedInterface $feed, FetcherResultInterface $fetcher_result, StateInterface $state) {
  if (!$state->total) {
    $state->total = $this->xpath
      ->evaluate('count(' . $this->configuration['context']['value'] . ')');
  }
  $start = (int) $state->pointer;
  $state->pointer = $start + $this->configuration['line_limit'];

  // A batched XPath expression.
  $context_query = '(' . $this->configuration['context']['value'] . ")[position() > {$start} and position() <= {$state->pointer}]";
  return $this->xpath
    ->query($context_query);
}