@Test public void testBrokenFrameset() throws Exception { final String test1 = "<html><head><title>Title</title>" + "<base href=\"http: "</head><body><frameset><frame src=\"frame.html\" /></frameset></body></html>"; StringWriter sw1 = new StringWriter(); new HtmlParser().parse( new ByteArrayInputStream(test1.getBytes(UTF_8)), makeHtmlTransformer(sw1), new Metadata(), new ParseContext()); String result = sw1.toString(); assertTrue(Pattern.matches("(?s).*<frame .* src=\"http: assertFalse(Pattern.matches("(?s).*<body>.*$", result)); final String test2 = "<html><head><title> my title </title></head><body>" + "<frameset rows=\"20,*\"><frame src=\"top.html\"></frame>" + "<frameset cols=\"20,*\"><frame src=\"left.html\"></frame>" + "<frame src=\"invalid.html\"/></frame>" + "<frame src=\"right.html\"></frame>" + "</frameset></frameset></body></html>"; StringWriter sw2 = new StringWriter(); new HtmlParser().parse( new ByteArrayInputStream(test2.getBytes(UTF_8)), makeHtmlTransformer(sw2), new Metadata(), new ParseContext()); result = sw2.toString(); assertTrue(Pattern.matches("(?s).*<frame .* src=\"top.html\"/>.*$", result)); assertTrue(Pattern.matches("(?s).*<frame .* src=\"left.html\"/>.*$", result)); assertTrue(Pattern.matches("(?s).*<frame .* src=\"invalid.html\"/>.*$", result)); assertTrue(Pattern.matches("(?s).*<frame .* src=\"right.html\"/>.*$", result)); assertFalse(Pattern.matches("(?s).*<body>.*$", result)); }
public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = null; try { if (!TikaInputStream.isTikaInputStream(stream)) { tmp = new TemporaryResources(); stream = TikaInputStream.get(stream, tmp); } parseImpl(stream, handler, metadata, context); } finally { if (tmp != null) { tmp.close(); } } }
HtmlParser extends AbstractEncodingDetectorParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = null; try { if (!TikaInputStream.isTikaInputStream(stream)) { tmp = new TemporaryResources(); stream = TikaInputStream.get(stream, tmp); } parseImpl(stream, handler, metadata, context); } finally { if (tmp != null) { tmp.close(); } } } }
HtmlParser extends AbstractEncodingDetectorParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = null; try { if (!TikaInputStream.isTikaInputStream(stream)) { tmp = new TemporaryResources(); stream = TikaInputStream.get(stream, tmp); } parseImpl(stream, handler, metadata, context); } finally { if (tmp != null) { tmp.close(); } } } HtmlParser();  HtmlParser(EncodingDetector encodingDetector); }
HtmlParser extends AbstractEncodingDetectorParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = null; try { if (!TikaInputStream.isTikaInputStream(stream)) { tmp = new TemporaryResources(); stream = TikaInputStream.get(stream, tmp); } parseImpl(stream, handler, metadata, context); } finally { if (tmp != null) { tmp.close(); } } } HtmlParser();  HtmlParser(EncodingDetector encodingDetector); Set<MediaType> getSupportedTypes(ParseContext context); void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context); String mapSafeAttribute(String elementName, String attributeName); @Field void setExtractScripts(boolean extractScripts); boolean getExtractScripts(); }
HtmlParser extends AbstractEncodingDetectorParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = null; try { if (!TikaInputStream.isTikaInputStream(stream)) { tmp = new TemporaryResources(); stream = TikaInputStream.get(stream, tmp); } parseImpl(stream, handler, metadata, context); } finally { if (tmp != null) { tmp.close(); } } } HtmlParser();  HtmlParser(EncodingDetector encodingDetector); Set<MediaType> getSupportedTypes(ParseContext context); void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context); String mapSafeAttribute(String elementName, String attributeName); @Field void setExtractScripts(boolean extractScripts); boolean getExtractScripts();  }