prevent self-closed tags in html documents, except for void tags
Thanks to Torok Edwin.
Also use String.compare instead of Pervasives.compare