CommonsXsdSchemaCollection implements XsdSchemaCollection, InitializingBean, ResourceLoaderAware { @Override public XmlValidator createValidator() { try { Resource[] resources = new Resource[xmlSchemas.size()]; for (int i = xmlSchemas.size() - 1; i >= 0; i--) { XmlSchema xmlSchema = xmlSchemas.get(i); String sourceUri = xmlSchema.getSourceURI(); if (StringUtils.hasLength(sourceUri)) { resources[i] = new UrlResource(sourceUri); } } return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new CommonsXsdSchemaException(ex.getMessage(), ex); } } CommonsXsdSchemaCollection();  CommonsXsdSchemaCollection(Resource... resources); void setXsds(Resource... xsdResources); void setInline(boolean inline); void setUriResolver(URIResolver uriResolver); @Override void setResourceLoader(ResourceLoader resourceLoader); @Override void afterPropertiesSet(); @Override XsdSchema[] getXsdSchemas(); @Override XmlValidator createValidator(); String toString();  }
@Test public void testCreateValidator() throws Exception { Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTestCase.class); collection.setXsds(a); collection.setInline(true); collection.afterPropertiesSet(); XmlValidator validator = collection.createValidator(); Assert.assertNotNull("No XmlValidator returned", validator); }