code: private function loadDocument($doc, $content)
      {
          $dom = new \DomDocument('1.0', $this->config->getOutputEncoding());
          if ($this->config->getOutputFormat() == 'xml') {
              $dom->loadXML($content);
          } else {
              $dom->loadHTML($content);
          }
  
          $metas = $dom->getElementsByTagName('meta');
          if ($metas) {
              $class = $this->config->getMetadataClass();
              /* @var $metadata MetadataInterface */
              $metadata = new $class();
              foreach ($metas as $meta) {
                  /* @var $meta \DOMElement */
                  $name = $meta->getAttribute('name');
                  $value = $meta->getAttribute('content');
                  $metadata->add($name, $value);
              }
              $doc->setMetadata($metadata);
          }
  
          $body = $dom->getElementsByTagName('body');
          if ($body) {
              $content = $body->item(0)->nodeValue;
              $doc->setContent($content);
          }
      }
docs: Load document
  
  @param DocumentInterface $doc
  @param string $content