public function render($ret = false)
{
$this->output = null;
if (null !== $this->doctype) {
$this->output .= str_replace('[{charset}]', $this->charset, Dom::$doctypes[$this->doctype]);
}
foreach ($this->childNodes as $child) {
$this->output .= $child->render(true, 0, $this->indent);
}
// If the return flag is passed, return output.
if ($ret) {
return $this->output;
// Else, print output.
} else {
if (null !== $this->doctype) {
if (!headers_sent()) {
header("HTTP/1.1 200 OK");
header("Content-type: " . $this->contentType);
}
}
echo $this->output;
}
}