}
private static HTMLDocument getHtmlDocument(Reader reader)
throws IOException, SAXException {
XMLReaderAdapter parser = new XMLReaderAdapter(new Parser());
HTMLBuilder builder = new HTMLBuilder();
parser.setDocumentHandler(builder);
parser.parse(new InputSource(reader));
return builder.getHTMLDocument();
}