Package org.xmlunit.validation
Class JAXPValidator
- java.lang.Object
-
- org.xmlunit.validation.Validator
-
- org.xmlunit.validation.JAXPValidator
-
public class JAXPValidator extends Validator
Validator using the javax.xml.validation namespace.An implementation detail of
javax.xml.validation.Validatorleaks into this class: anyxsi:schemaLocationorxsi:noSchemaLocationattribute of the instance document will be ignored if any schema source has been set. This means you must either specify all sources or none of them to successfully validate instances.
-
-
Constructor Summary
Constructors Constructor Description JAXPValidator(String language)Creates a validator for the given schema language using the default SchemaFactory.JAXPValidator(String language, SchemaFactory factory)Creates a validator for the given schema language using a custom SchemaFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetSchema(Schema s)Sets the schema to use in instance validation directly rather than viaValidator.setSchemaSource(javax.xml.transform.Source).ValidationResultvalidateInstance(Source s)Validates an instance against the schema.ValidationResultvalidateSchema()Validates a schema.-
Methods inherited from class org.xmlunit.validation.Validator
forLanguage, getSchemaSources, setSchemaSource, setSchemaSources
-
-
-
-
Constructor Detail
-
JAXPValidator
public JAXPValidator(String language)
Creates a validator for the given schema language using the default SchemaFactory.- Parameters:
language- the schema language
-
JAXPValidator
public JAXPValidator(String language, SchemaFactory factory)
Creates a validator for the given schema language using a custom SchemaFactory.- Parameters:
language- the schema languagefactory- the factory to use
-
-
Method Detail
-
setSchema
public final void setSchema(Schema s)
Sets the schema to use in instance validation directly rather than viaValidator.setSchemaSource(javax.xml.transform.Source).- Parameters:
s- the schema as Source- Since:
- XMLUnit 2.3.0
-
validateSchema
public ValidationResult validateSchema()
Description copied from class:ValidatorValidates a schema.- Specified by:
validateSchemain classValidator- Returns:
- result of the validation
-
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
-
-