XLIFF12Parser extends AbstractParser { @Override public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { metadata.set(Metadata.CONTENT_TYPE, XLF_CONTENT_TYPE.toString()); final XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); XMLReaderUtils.parseSAX( new CloseShieldInputStream(stream), new OfflineContentHandler(new XLIFF12ContentHandler(xhtml, metadata)), context); }  @Override Set<MediaType> getSupportedTypes(ParseContext context); @Override void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context);  }
@Test public void testXLIFF12() throws Exception { try (InputStream input = XLIFF12ParserTest.class.getResourceAsStream("/test-documents/testXLIFF12.xlf")) { Metadata metadata = new Metadata(); ContentHandler handler = new BodyContentHandler(); new XLIFF12Parser().parse(input, handler, metadata, new ParseContext()); String content = handler.toString(); assertContains("Hooray", content); assertEquals("2", metadata.get("file-count")); assertEquals("4", metadata.get("tu-count")); assertEquals("en", metadata.get("source-language")); assertEquals("fr", metadata.get("target-language")); } }