private static ExternalParser readParser(Element parserDef) throws TikaException {
        ExternalParser parser = new ExternalParser();

        NodeList children = parserDef.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node node = children.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                Element child = (Element) node;
                switch (child.getTagName()) {
                    case CHECK_TAG:
                        boolean present = readCheckTagAndCheck(child);
                        if (!present) {
                            return null;
                        }
                        break;
                    case COMMAND_TAG:
                        parser.setCommand(getString(child));
                        break;
                    case MIMETYPES_TAG:
                        parser.setSupportedTypes(readMimeTypes(child));
                        break;
                    case METADATA_TAG:
                        parser.setMetadataExtractionPatterns(readMetadataPatterns(child));
                        break;
                    default:
                        throw new IllegalArgumentException("reaction not defined for " + child.getTagName());
                }
            }
        }

        return parser;
    }
Builds and Returns an ExternalParser, or null if a check
command was given that didn't match.
tika-core/src/main/java/org/apache/tika/parser/external/ExternalParsersConfigReader.java