quote_html: Fix problems with comments, empty documents and other parsing exceptions