JAXBElementProvider<Book2> provider = new JAXBElementProvider<Book2>();
List<String> locations = new ArrayList<String>();
String loc = getClass().getClassLoader().getResource("test.xsd").toURI().getPath();
locations.add("file:" + loc);
provider.setSchemaLocations(locations);
Schema s = provider.getSchema();
assertNotNull("schema can not be read from disk", s);
provider.setValidateOutput(true);
provider.setValidateBeforeWrite(true);