예제 #1
0
 /**
  * Obtain a list of all errors in the given instance.
  *
  * <p>The list contains {@link org.xml.sax.SAXParseException SAXParseException} s.
  *
  * @throws XMLUnitRuntimeException if the schema definition is invalid or the Source is a
  *     SAXSource and the underlying XMLReader throws an IOException (see {@link
  *     javax.xml.validation.Validator#validate validate in Validator}).
  */
 public List<SAXParseException> getInstanceErrors(Source instance) {
   try {
     return problemToExceptionList(validator.validateInstance(instance).getProblems());
   } catch (XMLUnitRuntimeException e) {
     throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
   }
 }
예제 #2
0
 /**
  * Is the given schema instance valid according to the configured schema definition(s)?
  *
  * @throws XMLUnitRuntimeException if the schema definition is invalid or the Source is a
  *     SAXSource and the underlying XMLReader throws an IOException (see {@link
  *     javax.xml.validation.Validator#validate validate in Validator}).
  */
 public boolean isInstanceValid(Source instance) {
   try {
     return validator.validateInstance(instance).isValid();
   } catch (XMLUnitRuntimeException e) {
     throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
   }
 }