private void assertValidCML(String atomTypeList, String shortcut) throws Exception { InputStream ins = this.getClass().getClassLoader().getResourceAsStream(atomTypeList); File tmpInput = copyFileToTmp(shortcut, ".cmlinput", ins, "../../io/cml/data/cml25b1.xsd", "file://" + tmpCMLSchema.getAbsolutePath()); Assert.assertNotNull("Could not find the atom type list CML source", ins); InputStream cmlSchema = new FileInputStream(tmpCMLSchema); Assert.assertNotNull("Could not find the CML schema", cmlSchema); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); factory.setAttribute(JAXP_SCHEMA_LANGUAGE, cmlSchema); factory.setFeature("http://apache.org/xml/features/validation/schema", true); DocumentBuilder parser = factory.newDocumentBuilder(); parser.setErrorHandler(new SAXValidityErrorHandler(shortcut)); parser.parse(new FileInputStream(tmpInput)); }