I\'m importing some arbitrary HTML into a DOMDocument using the loadHTML() function, eg.:
DOMDocument
loadHTML()
$html = \'
Try using DOMDocument->saveXML()?
Test'; $doc = new DOMDocument(); $doc->loadHTML($html); $domnodelist = $doc->getElementsByTagName('p'); $domnode = $domnodelist->item(0); echo $doc->saveXML($domnode); ?>
It outputs Test
Test