@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(CloseShieldInputStream.wrap(stream),
                new XLIFF12ContentHandler(xhtml, metadata), context);

    }
@Test
    public void testXLIFF12() throws Exception {
        try (InputStream input = 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"));
        }
    }