I am using HTMLDom to manipulate a string, rather than a complete webpage. When I use saveHTML()
it automatically throws in doctype
and html
tags.
$str = 'frament containing html';
$str = utf8_encode($str);
$doc->LoadHTML($str);
...do stuff...
$str = $doc->saveHTML();
What is the correct way to save a fragment of HTML without the automatic inclusion of extra tags. Failing that; the correct method to remove these extra tags?
I used an html parser to avoid using regex's, so it seems a little counter-intuitive to have to use them on the output of a parser.