Skip to content

Instantly share code, notes, and snippets.

@talfco
Created April 5, 2015 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talfco/2df5852bb69b0860b16f to your computer and use it in GitHub Desktop.
Save talfco/2df5852bb69b0860b16f to your computer and use it in GitHub Desktop.
protected String cleanupHTML(String elem) {
Whitelist list = Whitelist.basicWithImages();
list.addTags("div");
list.addEnforcedAttribute("a", "rel", "nofollow");
list.addAttributes(":all","style");
String doc = Jsoup.clean(elem, list);
logger.debug("Jsoup.clean: "+doc);
Document xmlDoc = Jsoup.parse(doc);
return cleanupStyle(xmlDoc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment