Doctype declaration added

Fixes issue #588 which is caused by the lack of doctype declaration. The doctype declaration gets lost because of a bug in lxml