List of utility methods to do HTML Parse Jsoup
String | stripHtml(String html) strip Html return Jsoup.parse(html).text().replace("\u00a0", ""); |
String | tidyHtml(String html) tidy Html Document doc = Jsoup.parse(html);
doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
doc.outputSettings().prettyPrint(true);
doc.outputSettings().syntax(Document.OutputSettings.Syntax.xml);
return doc.html();
|
String | truncateHTML(String content, int len) truncate HTML Document dirtyDocument = Jsoup.parse(content); Element source = dirtyDocument.body(); Document clean = Document.createShell(dirtyDocument.baseUri()); Element dest = clean.body(); truncateHTML(source, dest, len); return dest.outerHtml().replace("<body>", "").replace("</body>", ""); |
String | unescapeHtml(String str) unescape Html return Parser.unescapeEntities(str, false);
|