예제 #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());
   }
 }
예제 #3
0
 /** Adds a source for the schema defintion. */
 public void addSchemaSource(Source s) {
   sources.add(s);
   validator.setSchemaSources(sources.toArray(new Source[0]));
 }
예제 #4
0
 /**
  * Obtain a list of all errors in the schema defintion.
  *
  * <p>The list contains {@link org.xml.sax.SAXParseException SAXParseException} s.
  */
 public List<SAXParseException> getSchemaErrors() {
   return problemToExceptionList(validator.validateSchema().getProblems());
 }
예제 #5
0
 /** Is the given schema definition valid? */
 public boolean isSchemaValid() {
   return validator.validateSchema().isValid();
 }