Package org.xmlunit.validation
Class ParsingValidator
java.lang.Object
org.xmlunit.validation.Validator
org.xmlunit.validation.ParsingValidator
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 Summary
ConstructorDescriptionParsingValidator
(String language) Creates a validator for the given schema language. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
The URI (or for example the System ID in case of a DTD) that identifies the schema validated or used during validation.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.Validates an instance against the schema.validateInstance
(Source s, SAXParserFactory factory) Validates an instance against the schema using a pre-configuredSAXParserFactory
.ParsingValidator
doesn't support validation of the schema itself.Methods inherited from class org.xmlunit.validation.Validator
forLanguage, getSchemaSources, setSchemaSource, setSchemaSources
-
Constructor Details
-
ParsingValidator
Creates a validator for the given schema language.- Parameters:
language
- the schema language
-
-
Method Details
-
setSchemaURI
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
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
ParsingValidator
doesn't support validation of the schema itself.- Specified by:
validateSchema
in classValidator
- Returns:
- result of the validation
- Throws:
XMLUnitException
- always
-
validateInstance
Description copied from class:Validator
Validates an instance against the schema.- Specified by:
validateInstance
in classValidator
- Parameters:
s
- the instance to validate- Returns:
- result of the validation
-
validateInstance
Validates an instance against the schema using a pre-configuredSAXParserFactory
.The factory given will be configured to be namespace aware and validating.
- Parameters:
s
- the instance documentfactory
- the factory to use, must not be null- Returns:
- result of the validation
- Since:
- XMLUnit 2.6.0
-