Exemplo n.º 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());
   }
 }
Exemplo n.º 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());
   }
 }
Exemplo n.º 3
0
 /** Adds a source for the schema defintion. */
 public void addSchemaSource(Source s) {
   sources.add(s);
   validator.setSchemaSources(sources.toArray(new Source[0]));
 }
Exemplo n.º 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());
 }
Exemplo n.º 5
0
 /** Is the given schema definition valid? */
 public boolean isSchemaValid() {
   return validator.validateSchema().isValid();
 }