Class ParsingValidator

java.lang.Object
org.xmlunit.validation.Validator
org.xmlunit.validation.ParsingValidator

public class ParsingValidator extends Validator
Validator implementation that uses "the old way" of validating an XML input by parsing the input.

Even though this implementation supports W3C Schema you shouldn't use it for that language but rather use JAXPValidator.

  • Constructor Details

    • ParsingValidator

      public ParsingValidator(String language)
      Creates a validator for the given schema language.
      Parameters:
      language - the schema language
  • Method Details

    • setSchemaURI

      public void setSchemaURI(String uri)
      The URI (or for example the System ID in case of a DTD) that identifies the schema to validate or use during validation.
      Parameters:
      uri - the schema URI
    • getSchemaURI

      protected String getSchemaURI()
      The URI (or for example the System ID in case of a DTD) that identifies the schema validated or used during validation.
      Returns:
      the schema URI
    • validateSchema

      public ValidationResult validateSchema()
      ParsingValidator doesn't support validation of the schema itself.
      Specified by:
      validateSchema in class Validator
      Returns:
      result of the validation
      Throws:
      XMLUnitException - always
    • validateInstance

      public ValidationResult validateInstance(Source s)
      Description copied from class: Validator
      Validates an instance against the schema.
      Specified by:
      validateInstance in class Validator
      Parameters:
      s - the instance to validate
      Returns:
      result of the validation
    • validateInstance

      public ValidationResult validateInstance(Source s, SAXParserFactory factory)
      Validates an instance against the schema using a pre-configured SAXParserFactory.

      The factory given will be configured to be namespace aware and validating.

      Parameters:
      s - the instance document
      factory - the factory to use, must not be null
      Returns:
      result of the validation
      Since:
      XMLUnit 2.6.0