You are here

protected function FeedsExBase::prepareRaw in Feeds extensible parsers 7

Prepares the raw string for parsing.

Parameters

FeedsFetcherResult $fetcher_result: The fetcher result.

Return value

string The prepared raw string.

5 calls to FeedsExBase::prepareRaw()
FeedsExHtml::prepareDocument in src/FeedsExHtml.inc
Prepares the DOM document.
FeedsExJmesPath::executeContext in src/FeedsExJmesPath.inc
Returns rows to be parsed.
FeedsExJsonPath::executeContext in src/FeedsExJsonPath.inc
Returns rows to be parsed.
FeedsExQueryPathHtml::prepareDocument in src/FeedsExQueryPathHtml.inc
Prepares the DOM document.
FeedsExXml::prepareDocument in src/FeedsExXml.inc
Prepares the DOM document.

File

src/FeedsExBase.inc, line 365
Contains FeedsExBase.

Class

FeedsExBase
The Feeds extensible parser.

Code

protected function prepareRaw(FeedsFetcherResult $fetcher_result) {
  $raw = $this
    ->getEncoder()
    ->convertEncoding($fetcher_result
    ->getRaw());

  // Strip null bytes.
  $raw = trim(str_replace("\0", '', $raw));

  // Check that the string has at least one character.
  if (!isset($raw[0])) {
    throw new FeedsExEmptyException();
  }
  return $raw;
}