@Test public void testRemoveTag() { String html = "<a onclick='alert(1)' onBlur='alert(1)'>你好</a><A>1</a>"; Assert.assertEquals("", HtmlUtils.removeTag(html, "a")); }
public static String removeTag(String html, String tagName) { Element bodyElement = Jsoup.parse(html).body(); bodyElement.getElementsByTag(tagName).remove(); return bodyElement.html(); }
HtmlUtils { public static String removeTag(String html, String tagName) { Element bodyElement = Jsoup.parse(html).body(); bodyElement.getElementsByTag(tagName).remove(); return bodyElement.html(); } }
HtmlUtils { public static String removeTag(String html, String tagName) { Element bodyElement = Jsoup.parse(html).body(); bodyElement.getElementsByTag(tagName).remove(); return bodyElement.html(); }  }
HtmlUtils { public static String removeTag(String html, String tagName) { Element bodyElement = Jsoup.parse(html).body(); bodyElement.getElementsByTag(tagName).remove(); return bodyElement.html(); }  static String text(String html); static String text(String html, int maxLength); static String removeUnSafeTag(String html); static String removeTag(String html, String tagName); }
HtmlUtils { public static String removeTag(String html, String tagName) { Element bodyElement = Jsoup.parse(html).body(); bodyElement.getElementsByTag(tagName).remove(); return bodyElement.html(); }  static String text(String html); static String text(String html, int maxLength); static String removeUnSafeTag(String html); static String removeTag(String html, String tagName);  }