throws XMLUnitRuntimeException {
Schema schema = null;
try {
schema = parseSchema(null);
} catch (SAXException e) {
throw new XMLUnitRuntimeException("Schema is invalid", e);
}
final ArrayList l = new ArrayList();
javax.xml.validation.Validator v = schema.newValidator();
v.setErrorHandler(new CollectingErrorHandler(l));
try {
v.validate(instance);
} catch (SAXException e) {
// error should have been recorded in our ErrorHandler,
// but better double-check.
if (l.size() == 0) {
l.add(e);
}
} catch (java.io.IOException i) {
throw new XMLUnitRuntimeException("Error reading instance source",
i);
}
return l;
}