You are here

protected function FieldRdfaTestBase::parseContent in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rdf/tests/src/Kernel/Field/FieldRdfaTestBase.php \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase::parseContent()
  2. 9 core/modules/rdf/tests/src/Kernel/Field/FieldRdfaTestBase.php \Drupal\Tests\rdf\Kernel\Field\FieldRdfaTestBase::parseContent()

Parses a content and return the html element.

Parameters

string $content: The html to parse.

Return value

array An array containing simplexml objects.

1 call to FieldRdfaTestBase::parseContent()
FieldRdfaTestBase::xpathContent in core/modules/rdf/tests/src/Kernel/Field/FieldRdfaTestBase.php
Performs an xpath search on a certain content.

File

core/modules/rdf/tests/src/Kernel/Field/FieldRdfaTestBase.php, line 138

Class

FieldRdfaTestBase

Namespace

Drupal\Tests\rdf\Kernel\Field

Code

protected function parseContent($content) {
  $htmlDom = new \DOMDocument();
  @$htmlDom
    ->loadHTML('<?xml encoding="UTF-8">' . $content);
  $elements = simplexml_import_dom($htmlDom);
  return $elements;
}