protected function FeedsExQueryPathXml::executeContext in Feeds extensible parsers 7
Same name and namespace in other branches
- 7.2 src/FeedsExQueryPathXml.inc \FeedsExQueryPathXml::executeContext()
Returns rows to be parsed.
Parameters
FeedsSource $source: Source information.
FeedsFetcherResult $fetcher_result: The result returned by the fetcher.
Return value
array|Traversable Some iterable that returns rows.
Overrides FeedsExXml::executeContext
File
- src/FeedsExQueryPathXml.inc, line 30 
- Contains FeedsExXml.
Class
- FeedsExQueryPathXml
- Parses XML documents with QueryPath.
Code
protected function executeContext(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
  $document = $this
    ->prepareDocument($source, $fetcher_result);
  $parser = new QueryPath($document, NULL, $this->queryPathOptions);
  $query_path = $parser
    ->find($this->config['context']['value']);
  $state = $source
    ->state(FEEDS_PARSE);
  if (!$state->total) {
    $state->total = $query_path
      ->size();
  }
  $start = (int) $state->pointer;
  $state->pointer = $start + $source->importer
    ->getLimit();
  $state
    ->progress($state->total, $state->pointer);
  return $query_path
    ->slice($start, $source->importer
    ->getLimit());
}