So, you just want to publish the HTML source as it is. The browser will not interpret the tags inside < HTML > ... < /HTML >.
If this is the case, it's not hard to do it, I think, if there's one instance of the < HTML > and < /HTML > markups.
The idea would be to grab the text inside these tags and then to replace < and > by "& lt;" and "& gt;"
This way, the text wil be displayed as a raw HTML code