You are here

protected function FeedsExQueryPathHtml::prepareDocument in Feeds extensible parsers 7.2

Same name and namespace in other branches
  1. 7 src/FeedsExQueryPathHtml.inc \FeedsExQueryPathHtml::prepareDocument()

Prepares the DOM document.

Parameters

FeedsSource $source: The feed source.

FeedsFetcherResult $fetcher_result: The fetcher result.

Return value

DOMDocument The DOM document.

Overrides FeedsExXml::prepareDocument

File

src/FeedsExQueryPathHtml.inc, line 61
Contains FeedsExQueryPathHtml.

Class

FeedsExQueryPathHtml
Parses HTML documents with QueryPath.

Code

protected function prepareDocument(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
  $raw = $fetcher_result
    ->getRaw();
  if (!strlen(trim($raw))) {
    throw new FeedsExEmptyException();
  }
  $raw = $this
    ->convertEncoding($raw);
  if ($this->config['use_tidy'] && extension_loaded('tidy')) {
    $raw = tidy_repair_string($raw, $this
      ->getTidyConfig(), 'utf8');
  }
  return FeedsExXmlUtility::createHtmlDocument($raw);
}