Do you need a text version of the html file? If so, all you need is something like:
InputStream input = new FileInputStream("myfile.html"); ContentHandler handler = new BodyContentHandler(); Metadata metadata = new Metadata(); new HtmlParser().parse(input, handler, metadata, new ParseContext()); String plainText = handler.toString();
A BodyContentHandler created without constructor arguments or with a character limit will capture the text (only) of the html body and return it to you.
Gagravarr
source share