Added full doctype support for HTML4, XHTML and HTML based on the format option passed to the engine.  Updated the IO tests to exercise this new support.
Merge conflict fixation rah rah rah.