18
If you use Jericho, then you just have to use something like this:
public String extractAllText(String htmlText){
Source source = new Source(htmlText);
return source.getTextExtractor().toString();
}
Of course you can do the same even with an Element:
for (Element link : links) {
System.out.println(link.getTextExtractor().toString());
}