DOM parser that allows HTML5-style

I had the same problem and apparently you can hack your way trough this by loading the document as XML, and save it as HTML 🙂

$d = new DOMDocument;
$d->loadXML('<script id="foo"><td>bar</td></script>');
echo $d->saveHTML();

But of course the markup must be error-free for loadXML to work.

Leave a Comment