DOMElement to html
Here is a quick way to get HTML from a DOMElement in PHP
function getHtmlFromDomElement($element) {
$doc = new DOMDocument();
foreach($element->childNodes as $child)
{
$doc->appendChild($doc->importNode($child, true));
}
return $doc->saveHTML();
}