Package org.xmlunit.validation
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 Summary
Constructors Constructor Description ParsingValidator(String language)Creates a validator for the given schema language.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetSchemaURI()The URI (or for example the System ID in case of a DTD) that identifies the schema validated or used during validation.voidsetSchemaURI(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.ValidationResultvalidateInstance(Source s)Validates an instance against the schema.ValidationResultvalidateInstance(Source s, SAXParserFactory factory)Validates an instance against the schema using a pre-configuredSAXParserFactory.ValidationResultvalidateSchema()ParsingValidatordoesn't support validation of the schema itself.-
Methods inherited from class org.xmlunit.validation.Validator
forLanguage, getSchemaSources, setSchemaSource, setSchemaSources
-
-
-
-
Constructor Detail
-
ParsingValidator
public ParsingValidator(String language)
Creates a validator for the given schema language.- Parameters:
language- the schema language
-
-
Method Detail
-
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()
ParsingValidatordoesn't support validation of the schema itself.- Specified by:
validateSchemain classValidator- Returns:
- result of the validation
- Throws:
XMLUnitException- always
-
validateInstance
public ValidationResult validateInstance(Source s)
Description copied from class:ValidatorValidates an instance against the schema.- Specified by:
validateInstancein classValidator- 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-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
-
-