You are here

protected function QueryPathHtmlParser::prepareDocument in Feeds extensible parsers 8

Prepares the DOM document.

Parameters

\Drupal\feeds\FeedInterface $feed: The feed source.

\Drupal\feeds\Result\FetcherResultInterface $fetcher_result: The fetcher result.

Return value

DOMDocument The DOM document.

Overrides XmlParser::prepareDocument

File

src/Feeds/Parser/QueryPathHtmlParser.php, line 47

Class

QueryPathHtmlParser
Defines a HTML parser using QueryPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function prepareDocument(FeedInterface $feed, FetcherResultInterface $fetcher_result) {
  $raw = $this
    ->prepareRaw($fetcher_result);
  if ($this->configuration['use_tidy'] && extension_loaded('tidy')) {
    $raw = tidy_repair_string($raw, $this
      ->getTidyConfig(), 'utf8');
  }
  return $this->utility
    ->createHtmlDocument($raw);
}