protected Unmarshaller createUnmarshaller() throws JAXBException, SAXException, FileNotFoundException, MalformedURLException {
Unmarshaller unmarshaller = getContext().createUnmarshaller();
if (schema != null) {
SchemaFactory factory = getOrCreateSchemaFactory();
try {
Schema newSchema = factory.newSchema(getSources());
unmarshaller.setSchema(newSchema);
unmarshaller.setEventHandler(new ValidationEventHandler() {
public boolean handleEvent(ValidationEvent event) {
// stop unmarshalling if the event is an ERROR or FATAL ERROR
return event.getSeverity() == ValidationEvent.WARNING;