HwpV5Parser extends AbstractParser { public HwpV5Parser() { extractor = new HwpTextExtractorV5(); } HwpV5Parser(); @Override Set<MediaType> getSupportedTypes(ParseContext context); @Override void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context); static final String HWP_MIME_TYPE; }
@Test public void testHwpV5Parser() throws Exception { for (Parser parser : new Parser[]{new HwpV5Parser(), AUTO_DETECT_PARSER}) { XMLResult result = getXML("testHWP-v5b.hwp", parser); assertContains("<p>Apache Tika - \uCEE8\uD150\uCE20", result.xml); Metadata metadata = result.metadata; assertEquals( "application/x-hwp-v5", metadata.get(Metadata.CONTENT_TYPE)); assertEquals("Apache Tika", metadata.get(TikaCoreProperties.TITLE)); assertEquals("SooMyung Lee", metadata.get(TikaCoreProperties.CREATOR)); assertContains("Apache Tika", result.xml.toString()); } }