public class JAXPValidator extends Validator
An implementation detail of javax.xml.validation.Validator
leaks into this class: any xsi:schemaLocation
or xsi:noSchemaLocation
attribute 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.
Modifier and Type | Field and Description |
---|---|
private javax.xml.validation.SchemaFactory |
factory |
private java.lang.String |
language |
private javax.xml.validation.Schema |
schema |
Constructor and Description |
---|
JAXPValidator(java.lang.String language) |
JAXPValidator(java.lang.String language,
javax.xml.validation.SchemaFactory factory) |
Modifier and Type | Method and Description |
---|---|
private javax.xml.validation.SchemaFactory |
getFactory() |
private javax.xml.validation.Schema |
getSchema() |
void |
setSchema(javax.xml.validation.Schema s)
Sets the schema to use in instance validation directly rather
than via
Validator.setSchemaSource(javax.xml.transform.Source) . |
ValidationResult |
validateInstance(javax.xml.transform.Source s)
Validates an instance against the schema.
|
ValidationResult |
validateSchema()
Validates a schema.
|
forLanguage, getSchemaSources, setSchemaSource, setSchemaSources
private final java.lang.String language
private final javax.xml.validation.SchemaFactory factory
private javax.xml.validation.Schema schema
public JAXPValidator(java.lang.String language)
public JAXPValidator(java.lang.String language, javax.xml.validation.SchemaFactory factory)
public final void setSchema(javax.xml.validation.Schema s)
Validator.setSchemaSource(javax.xml.transform.Source)
.private javax.xml.validation.SchemaFactory getFactory()
public ValidationResult validateSchema()
Validator
validateSchema
in class Validator
public ValidationResult validateInstance(javax.xml.transform.Source s)
Validator
validateInstance
in class Validator
private javax.xml.validation.Schema getSchema() throws org.xml.sax.SAXException
org.xml.sax.SAXException