Fix errors with HTML5 documents

Fix two errors parsing html5 documents
 * HTML5 does not have a DTD, so named entities can not be used when loading with domdocument.
 * Ensure xhtml structure so that the document can be loaded with domdocument->loadXML.  (this adds closing for void elements such as <link>).