Added reasonable parsing of the DOCTYPE declaration, fixed edge cases regarding bare ampersands in content.