Package org.xmlunit.validation
Class Validator
java.lang.Object
org.xmlunit.validation.Validator
- Direct Known Subclasses:
JAXPValidator
,ParsingValidator
Validates a piece of XML against a schema given in a supported
language or the definition of such a schema itself.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Validator
forLanguage
(String language) Factory that obtains a Validator instance based on the schema language.protected Source[]
Where to find the schema.final void
Where to find the schema.void
setSchemaSources
(Source... s) Where to find the schema.abstract ValidationResult
validateInstance
(Source instance) Validates an instance against the schema.abstract ValidationResult
Validates a schema.
-
Constructor Details
-
Validator
protected Validator()Creates a validator.
-
-
Method Details
-
setSchemaSources
Where to find the schema.- Parameters:
s
- locations of the schema definition
-
setSchemaSource
Where to find the schema.- Parameters:
s
- location of the schema definition
-
getSchemaSources
Where to find the schema.- Returns:
- locations of the schema definition
-
validateSchema
Validates a schema.- Returns:
- result of the validation
- Throws:
UnsupportedOperationException
- if the language's implementation doesn't support schema validation
-
validateInstance
Validates an instance against the schema.- Parameters:
instance
- the instance to validate- Returns:
- result of the validation
-
forLanguage
Factory that obtains a Validator instance based on the schema language.- Parameters:
language
- the schema language- Returns:
- a validator instance
- See Also:
-