http://code.google.com/p/jquery-clean/
$.htmlClean("<H1 class=\"header\"><P>Nested P Test</H1>", { format: true })
<p class=MsoNormal style='text-indent:36.0pt'>This is some <b>HTML</b> generated <i>by <o:p></o:p></i></p> <p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'>MS Word</p>