You are here

protected function FeedsExXml::executeContext in Feeds extensible parsers 7

Same name and namespace in other branches
  1. 7.2 src/FeedsExXml.inc \FeedsExXml::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 FeedsExBase::executeContext

1 method overrides FeedsExXml::executeContext()
FeedsExQueryPathXml::executeContext in src/FeedsExQueryPathXml.inc
Returns rows to be parsed.

File

src/FeedsExXml.inc, line 63
Contains FeedsExXml.

Class

FeedsExXml
Parses XML documents with XPath.

Code

protected function executeContext(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
  $state = $source
    ->state(FEEDS_PARSE);
  if (!$state->total) {
    $state->total = $this->xpath
      ->evaluate('count(' . $this->config['context']['value'] . ')');
  }
  $start = (int) $state->pointer;
  $state->pointer = $start + $source->importer
    ->getLimit();

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