@Test public void testExtractTitle() { logger.info("extractTitle"); String text = "<html><head><title>Page&#39;s &amp; \nWebsite&#39;s title</title></head></html>"; String expResult = "Page's & Website's title"; String result = HTMLParser.extractTitle(text); assertEquals(expResult, result); }
public static String extractTitle(String html) { Matcher m = TITLE_PATTERN.matcher(html); if (m.find()) { return clear(m.group(0)); } return null; }
HTMLParser { public static String extractTitle(String html) { Matcher m = TITLE_PATTERN.matcher(html); if (m.find()) { return clear(m.group(0)); } return null; } }
HTMLParser { public static String extractTitle(String html) { Matcher m = TITLE_PATTERN.matcher(html); if (m.find()) { return clear(m.group(0)); } return null; }  }
HTMLParser { public static String extractTitle(String html) { Matcher m = TITLE_PATTERN.matcher(html); if (m.find()) { return clear(m.group(0)); } return null; }  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 extractTitle(String html) { Matcher m = TITLE_PATTERN.matcher(html); if (m.find()) { return clear(m.group(0)); } return null; }  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);  }