StringWriter stringWriter = new StringWriter();
//FIXME ??
PrintWriter errorWriter = new PrintWriter(stringWriter);
tidy.setErrout(errorWriter);
// Extract the document using JTidy and stream it.
Document doc = tidy.parseDOM(new BufferedInputStream(stream), null);
errorWriter.flush();
errorWriter.close();
return doc;
}
catch (Exception ex) {