You can try HTML Tidy. May not work depending on the quality of the HTML but worth a try.
written by objects \\ tags: html, HTML Tidy, xhtml