use of org.apache.tika.batch.DigestingAutoDetectParserFactory in project tika by apache.
the class AppParserFactoryBuilder method build.
@Override
public ParserFactory build(Node node, Map<String, String> runtimeAttrs) {
Map<String, String> localAttrs = XMLDOMUtil.mapifyAttrs(node, runtimeAttrs);
String className = localAttrs.get("class");
ParserFactory pf = ClassLoaderUtil.buildClass(ParserFactory.class, className);
if (localAttrs.containsKey("parseRecursively")) {
String bString = localAttrs.get("parseRecursively").toLowerCase(Locale.ENGLISH);
if (bString.equals("true")) {
pf.setParseRecursively(true);
} else if (bString.equals("false")) {
pf.setParseRecursively(false);
} else {
throw new RuntimeException("parseRecursively must have value of \"true\" or \"false\": " + bString);
}
}
if (pf instanceof DigestingAutoDetectParserFactory) {
DigestingParser.Digester d = buildDigester(localAttrs);
((DigestingAutoDetectParserFactory) pf).setDigester(d);
}
return pf;
}
Aggregations