19declare(strict_types=1);
27 public function isValid(): bool
29 if (!preg_match(
'/<[^>]+?>/', $this->text)) {
34 $dom =
new DOMDocument();
35 if (!$dom->loadHTML($this->text)) {
39 $iter =
new RecursiveIteratorIterator(
41 RecursiveIteratorIterator::SELF_FIRST
43 foreach ($iter as $element) {
45 if (strtolower((
string) $element->nodeName) ===
'body') {
49 if ($element->nodeType === XML_ELEMENT_NODE) {
53 }
catch (Exception|Throwable) {
Class ilHtmlDomNodeIterator.
__construct(private string $text)