- var_dump: documentation ( source)
<?php
$dom = new DOMDocument();
$dom->loadHtml('<html xmlns:f="foo"><body f:bar="bar"></body></html>');
var_dump((boolean) $dom->getElementsByTagName('head')->length ? '<head> available' : '<head> not available');
var_dump((boolean) $dom->getElementsByTagName('body')->length ? '<body> available' : '<body> not available');
foreach ($dom->getElementsByTagName('body')->item(0)->attributes as $attr) {
var_dump($attr->namespaceURI.'#'.$attr->nodeName);
}