public class SchemaValidate extends XMLValidateTask
XMLValidateTask
Modifier and Type | Class and Description |
---|---|
static class |
SchemaValidate.SchemaLocation
representation of a schema location.
|
XMLValidateTask.Attribute, XMLValidateTask.Property, XMLValidateTask.ValidatorErrorHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ERROR_DUPLICATE_SCHEMA
Duplicate declaration of schema
|
static java.lang.String |
ERROR_NO_XSD_SUPPORT
schema features not supported
|
static java.lang.String |
ERROR_PARSER_CREATION_FAILURE
unable to create parser
|
static java.lang.String |
ERROR_SAX_1
SAX1 not supported
|
static java.lang.String |
ERROR_TOO_MANY_DEFAULT_SCHEMAS
too many default schemas
|
static java.lang.String |
MESSAGE_ADDING_SCHEMA
adding schema
|
classpath, errorHandler, failOnError, file, filesets, INIT_FAILED_MSG, lenient, MESSAGE_FILES_VALIDATED, readerClassName, warn, xmlReader
description, location, project
Constructor and Description |
---|
SchemaValidate() |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguredSchema(SchemaValidate.SchemaLocation location)
add the schema
|
protected void |
addSchemaLocations()
build a string list of all schema locations, then set the relevant
property.
|
protected void |
createAnonymousSchema()
create a schema location to hold the anonymous
schema
|
protected org.xml.sax.XMLReader |
createDefaultReader()
Create a reader if the use of the class did not specify another one.
|
boolean |
enableJAXP12SchemaValidation()
Set schema attributes in a JAXP 1.2 engine.
|
boolean |
enableXercesSchemaValidation()
Turn on XSD support in Xerces.
|
protected java.lang.String |
getNoNamespaceSchemaURL()
get the URL of the no namespace schema
|
void |
init()
Called by the project to let the task initialize properly.
|
protected void |
initValidator()
init the parser : load the parser class, and set features if necessary It
is only after this that the reader is valid
|
protected void |
onSuccessfulValidation(int fileProcessed)
handler called on successful file validation.
|
void |
setDisableDTD(boolean disableDTD)
flag to disable DTD support.
|
protected void |
setFeatureIfSupported(java.lang.String feature,
boolean value)
set a feature if it is supported, log at verbose level if
not
|
void |
setFullChecking(boolean fullChecking)
enable full schema checking.
|
void |
setNoNamespaceFile(java.io.File defaultSchemaFile)
identify a file containing the default schema
|
void |
setNoNamespaceURL(java.lang.String defaultSchemaURL)
identify the URL of the default schema
|
addConfiguredXMLCatalog, addFileset, cleanup, createAttribute, createClasspath, createDTD, createProperty, createXmlReader, doValidate, execute, getEntityResolver, getXmlReader, isSax1Parser, setClassName, setClasspath, setClasspathRef, setFailOnError, setFeature, setFile, setLenient, setProperty, setWarn
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public static final java.lang.String ERROR_SAX_1
public static final java.lang.String ERROR_NO_XSD_SUPPORT
public static final java.lang.String ERROR_TOO_MANY_DEFAULT_SCHEMAS
public static final java.lang.String ERROR_PARSER_CREATION_FAILURE
public static final java.lang.String MESSAGE_ADDING_SCHEMA
public static final java.lang.String ERROR_DUPLICATE_SCHEMA
public void init() throws BuildException
init
in class XMLValidateTask
BuildException
- if something goes wrong with the buildpublic boolean enableXercesSchemaValidation()
public boolean enableJAXP12SchemaValidation()
public void addConfiguredSchema(SchemaValidate.SchemaLocation location)
location
- the schema location.BuildException
- if there is no namespace, or if there already
is a declaration of this schema with a different valuepublic void setFullChecking(boolean fullChecking)
fullChecking
- a boolean
value.protected void createAnonymousSchema()
public void setNoNamespaceURL(java.lang.String defaultSchemaURL)
defaultSchemaURL
- the URL of the default schema.public void setNoNamespaceFile(java.io.File defaultSchemaFile)
defaultSchemaFile
- the location of the default schema.public void setDisableDTD(boolean disableDTD)
disableDTD
- a boolean
value.protected void initValidator()
initValidator
in class XMLValidateTask
BuildException
- if something went wrongprotected org.xml.sax.XMLReader createDefaultReader()
JAXPUtils.getXMLReader()
was to
create our own factory with our own options.createDefaultReader
in class XMLValidateTask
protected void addSchemaLocations()
protected java.lang.String getNoNamespaceSchemaURL()
protected void setFeatureIfSupported(java.lang.String feature, boolean value)
feature
- the feature.value
- a boolean
value.protected void onSuccessfulValidation(int fileProcessed)
onSuccessfulValidation
in class XMLValidateTask
fileProcessed
- number of files processed.