@Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
            throws SAXException {

        final AttributesImpl attributeVals = new AttributesImpl();
        attributeVals.setAttributes(attributes);

        if ("header".equals(localName)) {
            metadata.add("creation-tool", attributes.getValue("creationtool"));
            metadata.add("creation-tool-version", attributes.getValue("creationtoolversion"));
            metadata.add("segment-type", attributes.getValue("segtype"));
            metadata.add("original-format-type", attributes.getValue("o-tmf"));
            metadata.add("data-type", attributes.getValue("datatype"));
            sourceLang = attributes.getValue("srclang");
            metadata.add("source-language", sourceLang);
            metadata.add("admin-language", attributes.getValue("adminlang"));
        }

        if ("tu".equals(localName)) {
            numberOfTUs++;
            AttributesImpl attrs = extractAttributes(attributes);
            xhtml.startElement("div", attrs);
        }

        if ("tuv".equals(localName)) {
            numberOfTUVs++;
            AttributesImpl attrs = extractAttributes(attributes);
            xhtml.startElement("p", attrs);
        }

        if ("seg".equals(localName)) {
            inSegment = true;
        }

    }
Content Handler for Translation Memory eXchange (TMX) files.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-xml-module/src/main/java/org/apache/tika/parser/tmx/TMXContentHandler.java