You are here

protected function XmlParser::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.

2 calls to XmlParser::prepareDocument()
QueryPathXmlParser::executeContext in src/Feeds/Parser/QueryPathXmlParser.php
Returns rows to be parsed.
XmlParser::setUp in src/Feeds/Parser/XmlParser.php
Allows subclasses to prepare for parsing.
2 methods override XmlParser::prepareDocument()
HtmlParser::prepareDocument in src/Feeds/Parser/HtmlParser.php
Prepares the DOM document.
QueryPathHtmlParser::prepareDocument in src/Feeds/Parser/QueryPathHtmlParser.php
Prepares the DOM document.

File

src/Feeds/Parser/XmlParser.php, line 299

Class

XmlParser
Defines a XML parser using XPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function prepareDocument(FeedInterface $feed, FetcherResultInterface $fetcher_result) {
  $raw = $this
    ->prepareRaw($fetcher_result);

  // Remove default namespaces. This has to run after the encoding conversion
  // because a limited set of encodings are supported in regular expressions.
  $raw = $this
    ->removeDefaultNamespaces($raw);
  if ($this->configuration['use_tidy'] && extension_loaded('tidy')) {
    $raw = tidy_repair_string($raw, $this
      ->getTidyConfig(), 'utf8');
  }
  $raw = $this->utility
    ->decodeNamedHtmlEntities($raw);
  return $this
    ->getDomDocument($raw);
}