Tried JTidy and Jericho here. For the following sample.
The address tag has no end tag. With JTidy, the output file was empty. May be it was parsing node-wise and did not end up with finshing-address tag.
While output from FormatSource.jsp of Jericho
Jericho was
Not bad. I suspect if Jericho will have a node-base-parsing, for JTidy I do see a class "org.w3c.tidy.Node" in the docs, but seems documentation has not been updated since 2000.
[ November 05, 2008: Message edited by: Akhilesh Trivedi ]