@Test public void testIdentityMapper() throws Exception { final String html = "<html><head><title>Title</title></head>" + "<body></body></html>"; Metadata metadata = new Metadata(); ParseContext parseContext = new ParseContext(); parseContext.set(HtmlMapper.class, IdentityHtmlMapper.INSTANCE); StringWriter sw = new StringWriter(); new HtmlParser().parse( new ByteArrayInputStream(html.getBytes(UTF_8)), makeHtmlTransformer(sw), metadata, parseContext); String result = sw.toString(); assertTrue(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();  }