private static final XMLParser getParser(String model) {
XMLParser parser = (XMLParser) parsers.get(model);
if (parser == null) {
String className = (String) parserClasses.get(model);
if (className == null) {
throw new JXPathException("Unsupported XML model: " + model);
}
try {
Class clazz = Class.forName(className);
parser = (XMLParser) clazz.newInstance();
}
catch (Exception ex) {
throw new JXPathException(
"Cannot allocate XMLParser: " + className);
}
parsers.put(model, parser);
}
return parser;