Track document types when parsing.

When parsing XML/HTML documents the corresponding document type (:html or :xml)
is stored in Document#type.
self-close certain XML/HTML elements.

When an XML element has no child nodes a self-closing tag is used. When parsing
documents/elements in HTML mode this is only done if the element is a so called
"void element" (e.g. <link> tags).

This fixes #46.