Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Crawler.php

function Crawler::parseHtml5

1 call to Crawler::parseHtml5()
Crawler::parseHtmlString in vendor/symfony/dom-crawler/Crawler.php
Parse string into DOMDocument object using HTML5 parser if the content is HTML5 and the library is available. Use libxml parser otherwise.

File

vendor/symfony/dom-crawler/Crawler.php, line 1063

Class

Crawler
Crawler eases navigation of a list of \DOMNode objects.

Namespace

Symfony\Component\DomCrawler

Code

private function parseHtml5(string $htmlContent, string $charset = 'UTF-8') : \DOMDocument {
    if (!$this->supportsEncoding($charset)) {
        $htmlContent = $this->convertToHtmlEntities($htmlContent, $charset);
        $charset = 'UTF-8';
    }
    return $this->html5Parser
        ->parse($htmlContent, [
        'encoding' => $charset,
    ]);
}
RSS feed
Powered by Drupal