Class 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.

    • Field Detail

      • language

        private final java.lang.String language
      • schemaURI

        private java.lang.String schemaURI
    • Constructor Detail

      • ParsingValidator

        public ParsingValidator​(java.lang.String language)
        Creates a validator for the given schema language.
        Parameters:
        language - the schema language
    • Method Detail

      • setSchemaURI

        public void setSchemaURI​(java.lang.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 java.lang.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
      • validateInstance

        public ValidationResult validateInstance​(javax.xml.transform.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​(javax.xml.transform.Source s,
                                                 javax.xml.parsers.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