@Test public void testReplaceImgWithAlt() { logger.info("replaceImgWithAlt"); String text = "some text <img src=\"s.jpg\" title=\"here\"> and <img src=\"s.jpg\" alt=\"there\"> and everywhere"; String expResult = "some text here and there and everywhere"; String result = HTMLParser.replaceImgWithAlt(text); assertEquals(expResult, result); }
public static String replaceImgWithAlt(String html) { Matcher m = IMG_ALT_TITLE_PATTERN.matcher(html); if (m.find()) { return m.replaceAll(" $1 "); } return html; }
HTMLParser { public static String replaceImgWithAlt(String html) { Matcher m = IMG_ALT_TITLE_PATTERN.matcher(html); if (m.find()) { return m.replaceAll(" $1 "); } return html; } }
HTMLParser { public static String replaceImgWithAlt(String html) { Matcher m = IMG_ALT_TITLE_PATTERN.matcher(html); if (m.find()) { return m.replaceAll(" $1 "); } return html; }  }
HTMLParser { public static String replaceImgWithAlt(String html) { Matcher m = IMG_ALT_TITLE_PATTERN.matcher(html); if (m.find()) { return m.replaceAll(" $1 "); } return html; }  static String replaceImgWithAlt(String html); static String removeComments(String html); static String unsafeRemoveAllTags(String html); static String safeRemoveAllTags(String html); static String removeNonTextTagsAndAttributes(String html); static String extractText(String html); static String extractTitle(String html); static Map<HyperlinkPart, List<String>> extractHyperlinks(String html); static Map<String, String> extractMetatags(String html); static Map<String, List<String>> extractHTMLheaders(String html); }
HTMLParser { public static String replaceImgWithAlt(String html) { Matcher m = IMG_ALT_TITLE_PATTERN.matcher(html); if (m.find()) { return m.replaceAll(" $1 "); } return html; }  static String replaceImgWithAlt(String html); static String removeComments(String html); static String unsafeRemoveAllTags(String html); static String safeRemoveAllTags(String html); static String removeNonTextTagsAndAttributes(String html); static String extractText(String html); static String extractTitle(String html); static Map<HyperlinkPart, List<String>> extractHyperlinks(String html); static Map<String, String> extractMetatags(String html); static Map<String, List<String>> extractHTMLheaders(String html);  }