-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Description
Description
The following code:
<?php
use Dom\HTMLDocument;
use Dom\XPath;
$html = '<html><body><p>Hello World</p></body></html>';
$dom = HTMLDocument::createFromString($html, LIBXML_NOERROR);
$xpath = new XPath($dom);
$query = '//body//text()';
foreach ($xpath->query($query) as $text) { echo $text->nodeValue . "\n"; }Resulted in this output:
Nothing
But I expected this output instead:
Hello World
This worked perfectly with DOMXPath.
PHP Version
PHP 8.4.1
Operating System
MacOS 15.1.1 (24B91) / AlmaLinux 9.5