Google Code Issue 152: Doctypes don't match serialization output

> Reported by @fantasai, Jun 1, 2010
> **What steps will reproduce the problem?**
>  Serialize a document with an XHTML doctype as HTML or vice versa

> **What is the expected output? What do you see instead?**
> I expect an appropriate doctype. Or at least the ability to request an appropriate doctype.

>  I see instead the same doctype that was parsed in, even if it's not valid for the output.

> My branch currently uses the attached changes.