I\'m manipulating a short HTML snippet with XPath; when I output the changed snippet back with $doc->saveHTML(), DOCTYPE
gets added, and HTML / BODY
You have 2 ways to accomplish this:
$content = substr($content, strpos($content, '') + 12); // Remove Everything Before & Including The Opening HTML & Body Tags.
$content = substr($content, 0, -14); // Remove Everything After & Including The Closing HTML & Body Tags.
Or even better is this way:
$dom->normalizeDocument();
$content = $dom->saveHTML();