I’ve been using JTidy with much success, but I couldn’t for the life of me figure out how to make it stop spewing warnings and errors to the console (specifically, stderr) whenever I would call parseDom();
Did a lot of Googling to no avail. Here’s what I had to do:
1) Download the snapshot of version 8 from the Maven repository instead of the 2001 version 7 they have on the homepage.
2) Use following code:
Tidy tidy = new Tidy();
tidy.setQuiet(true); // you'd think this would do it, huh?
tidy.setShowWarnings(false); // turn off warnings
tidy.setShowErrors(0); // show zero errors (an int, not a boolean like above???)
tidy.parseDOM( , null ); //null means don't send to any output stream
What an atrocious API! Four unintuitive changes just to get it to stop printing to the console? Oi.