Here are some problems with the first suggestion.
Using 'View Generated Source' removes the DOCTYPE from the code that it displays, and converts self closing tags to invalid, unclosed tags.
For example, the standard 'View Source' displays this at the top:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://forums.xisto.com/no_longer_exists/">
<html xmlns="http://forums.xisto.com/no_longer_exists/" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
'View Generated Source' for the same page displays this at the top:
<html xml:lang="en" xmlns="http://forums.xisto.com/no_longer_exists/" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Other self closing tags such as "br", "img", "input" are reported as ..'end tag omitted..'.
I'm not sure how to use htmlentities() to output the entire source of a dynamically generated page. Eclipse seems to be working on component to address this issue. http://forums.xisto.com/no_longer_exists/