String errors = "";
GenericSchemaValidator genericValidator = new GenericSchemaValidator();
genericValidator.setSchema(new URI("http://www.psidev.info/files/mzIdentML1.1.0.xsd"));
ErrorHandlerIface handler = new ValidationErrorHandler();
genericValidator.setErrorHandler(handler);
BufferedReader br = new BufferedReader(new FileReader(mzidFile));
genericValidator.validate(br);
//noinspection unchecked
List<String> errorMsgs = handler.getErrorMessages();
if (!errorMsgs.isEmpty()) {
int errorCount = 0;
for (String error : errorMsgs) {
errors += ++errorCount + ": " + error + "\n\n";
System.out.println(errorCount + ": " + error);