Make JTidy STFU

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.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: