protected function QueryPathXmlParser::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 XmlParser::executeContext
File
- src/
Feeds/ Parser/ QueryPathXmlParser.php, line 43
Class
- QueryPathXmlParser
- Defines a XML parser using QueryPath.
Namespace
Drupal\feeds_ex\Feeds\ParserCode
protected function executeContext(FeedInterface $feed, FetcherResultInterface $fetcher_result, StateInterface $state) {
$document = $this
->prepareDocument($feed, $fetcher_result);
$query_path = QueryPath::with($document, $this->configuration['context']['value'], $this->queryPathOptions);
if (!$state->total) {
$state->total = $query_path
->size();
}
$start = (int) $state->pointer;
$state->pointer = $start + $this->configuration['line_limit'];
$state
->progress($state->total, $state->pointer);
return $query_path
->slice($start, $this->configuration['line_limit']);
}