*
* @throws ConfigurationException thrown if there is a problem initializing the validator suites, usually because of
* malformed elements
*/
protected void initializeValidatorSuites(Element validatorSuitesElement) throws ConfigurationException {
ValidatorSuite validatorSuite;
Validator validator;
Element validatorSuiteElement;
String validatorSuiteId;
Element validatorElement;
QName validatorQName;
NodeList validatorSuiteList = validatorSuitesElement.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
"ValidatorSuite");
for (int i = 0; i < validatorSuiteList.getLength(); i++) {
validatorSuiteElement = (Element) validatorSuiteList.item(i);
validatorSuiteId = validatorSuiteElement.getAttributeNS(null, "id");
validatorSuite = new ValidatorSuite(validatorSuiteId);
log.debug("Initializing ValidatorSuite {}", validatorSuiteId);
log.trace(XMLHelper.nodeToString(validatorSuiteElement));
NodeList validatorList = validatorSuiteElement.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
"Validator");
for (int j = 0; j < validatorList.getLength(); j++) {
validatorElement = (Element) validatorList.item(j);
validatorQName = XMLHelper.getAttributeValueAsQName(validatorElement.getAttributeNodeNS(null,
"qualifiedName"));
validator = (Validator) createClassInstance(validatorElement);
validatorSuite.registerValidator(validatorQName, validator);
}
log.debug("ValidtorSuite {} has been initialized", validatorSuiteId);
if(retainXMLConfiguration){
Configuration.registerValidatorSuite(validatorSuiteId, validatorSuite, validatorSuiteElement);