Package org.xmlunit.validation
Class Validator
- java.lang.Object
-
- org.xmlunit.validation.Validator
-
- Direct Known Subclasses:
JAXPValidator,ParsingValidator
public abstract class Validator extends java.lang.ObjectValidates a piece of XML against a schema given in a supported language or the definition of such a schema itself.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedValidator()Creates a validator.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ValidatorforLanguage(java.lang.String language)Factory that obtains a Validator instance based on the schema language.protected javax.xml.transform.Source[]getSchemaSources()Where to find the schema.voidsetSchemaSource(javax.xml.transform.Source s)Where to find the schema.voidsetSchemaSources(javax.xml.transform.Source... s)Where to find the schema.abstract ValidationResultvalidateInstance(javax.xml.transform.Source instance)Validates an instance against the schema.abstract ValidationResultvalidateSchema()Validates a schema.
-
-
-
Method Detail
-
setSchemaSources
public void setSchemaSources(javax.xml.transform.Source... s)
Where to find the schema.- Parameters:
s- locations of the schema definition
-
setSchemaSource
public final void setSchemaSource(javax.xml.transform.Source s)
Where to find the schema.- Parameters:
s- location of the schema definition
-
getSchemaSources
protected javax.xml.transform.Source[] getSchemaSources()
Where to find the schema.- Returns:
- locations of the schema definition
-
validateSchema
public abstract ValidationResult validateSchema()
Validates a schema.- Returns:
- result of the validation
- Throws:
java.lang.UnsupportedOperationException- if the language's implementation doesn't support schema validation
-
validateInstance
public abstract ValidationResult validateInstance(javax.xml.transform.Source instance)
Validates an instance against the schema.- Parameters:
instance- the instance to validate- Returns:
- result of the validation
-
-