import java.io.*;
import net.htmlparser.jericho.*;
public class HTMLParserExample {
public static void main(String[] args) throws IOException {
String fileName = "example.html";
String source = new String(Files.readAllBytes(Paths.get(fileName)));
Source htmlSource = new Source(source);
Element titleElement = htmlSource.getFirstElement(HTMLElementName.TITLE);
String title = titleElement.getTextExtractor().toString();
StringBuilder content = new StringBuilder();
for (Element element : htmlSource.getAllElementsByClass("content")) {
content.append(element.getTextExtractor().toString()).append("
");
}
" + content);
}
}