private ComponentDefinitionRegistry validateAndPopulate (Parser parser, Bundle clientBundle, boolean validate)
throws IOException, SAXException {
Set<URI> nsuris = parser.getNamespaces();
ComponentDefinitionRegistry cdr;
NamespaceHandlerSet nshandlers = _namespaceHandlerRegistry.getNamespaceHandlers(nsuris, clientBundle);
try {
if (validate) {
parser.validate( nshandlers.getSchema());
}
cdr = new ComponentDefinitionRegistryImpl();
parser.populate(nshandlers, cdr);
} finally {
nshandlers.destroy();
}
return cdr;
}