}
/* If still we didn't find any parser, simply die of natural death */
if (parser == null) {
String message = "Unsupported grammar language" + grammar;
throw new ValidatorException(message);
}
/* Somehow we have a schema parser, check it supports the gramar */
String languages[] = parser.getSupportedGrammars();
for (int x = 0; x < languages.length; x++) {
if (! language.equals(languages[x])) continue;
/* Hah! language supported, go ahead and parse now */
Schema schema = this.getSchema(parser, source, language);
return schema.createValidator(errorHandler);
}
/* Something really odd going on, this should never happen */
String message = "Schema parser " + parser.getClass().getName() +
" does not support grammar " + grammar;
throw new ValidatorException(message);
} finally {
if (parser != null) this.releaseParser(parser);
}
}