Class SchemaValidate
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.optional.XMLValidateTask
org.apache.tools.ant.taskdefs.optional.SchemaValidate
- All Implemented Interfaces:
- Cloneable
Validate XML Schema documents.
 This task validates XML schema documents. It requires an XML parser
 that handles the relevant SAX, Xerces or JAXP options.
 To resolve remote references, Ant may need its proxy set up, using the
 setproxy task.
 Hands off most of the work to its parent, 
XMLValidateTask- Since:
- Ant1.7
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classrepresentation of a schema location.Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.optional.XMLValidateTaskXMLValidateTask.Attribute, XMLValidateTask.Property, XMLValidateTask.ValidatorErrorHandler
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringDuplicate declaration of schemastatic final Stringschema features not supportedstatic final Stringunable to create parserstatic final StringSAX1 not supportedstatic final Stringtoo many default schemasstatic final Stringadding schemaFields inherited from class org.apache.tools.ant.taskdefs.optional.XMLValidateTaskclasspath, errorHandler, failOnError, file, filesets, INIT_FAILED_MSG, lenient, MESSAGE_FILES_VALIDATED, readerClassName, warn, xmlReaderFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd the schemaprotected voidbuild a string list of all schema locations, then set the relevant property.protected voidcreate a schema location to hold the anonymous schemaprotected XMLReaderCreate a reader if the use of the class did not specify another one.booleanSet schema attributes in a JAXP 1.2 engine.booleanTurn on XSD support in Xerces.protected Stringget the URL of the no namespace schemavoidinit()Called by the project to let the task initialize properly.protected voidinit the parser : load the parser class, and set features if necessary It is only after this that the reader is validprotected voidonSuccessfulValidation(int fileProcessed) handler called on successful file validation.voidsetDisableDTD(boolean disableDTD) flag to disable DTD support.protected voidsetFeatureIfSupported(String feature, boolean value) set a feature if it is supported, log at verbose level if notvoidsetFullChecking(boolean fullChecking) enable full schema checking.voidsetNoNamespaceFile(File defaultSchemaFile) identify a file containing the default schemavoidsetNoNamespaceURL(String defaultSchemaURL) identify the URL of the default schemaMethods inherited from class org.apache.tools.ant.taskdefs.optional.XMLValidateTaskaddConfiguredXMLCatalog, addFileset, cleanup, createAttribute, createClasspath, createDTD, createProperty, createXmlReader, doValidate, execute, getEntityResolver, getXmlReader, isSax1Parser, setClassName, setClasspath, setClasspathRef, setFailOnError, setFeature, setFile, setLenient, setProperty, setWarnMethods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
- 
Field Details- 
ERROR_SAX_1SAX1 not supported- See Also:
 
- 
ERROR_NO_XSD_SUPPORTschema features not supported- See Also:
 
- 
ERROR_TOO_MANY_DEFAULT_SCHEMAStoo many default schemas- See Also:
 
- 
ERROR_PARSER_CREATION_FAILUREunable to create parser- See Also:
 
- 
MESSAGE_ADDING_SCHEMAadding schema- See Also:
 
- 
ERROR_DUPLICATE_SCHEMADuplicate declaration of schema- See Also:
 
 
- 
- 
Constructor Details- 
SchemaValidatepublic SchemaValidate()
 
- 
- 
Method Details- 
initCalled by the project to let the task initialize properly. The default implementation is a no-op.- Overrides:
- initin class- XMLValidateTask
- Throws:
- BuildException- if something goes wrong with the build
 
- 
enableXercesSchemaValidationpublic boolean enableXercesSchemaValidation()Turn on XSD support in Xerces.- Returns:
- true on success, false on failure
 
- 
enableJAXP12SchemaValidationpublic boolean enableJAXP12SchemaValidation()Set schema attributes in a JAXP 1.2 engine.- Returns:
- true on success, false on failure
- See Also:
 
- 
addConfiguredSchemaadd the schema- Parameters:
- location- the schema location.
- Throws:
- BuildException- if there is no namespace, or if there already is a declaration of this schema with a different value
 
- 
setFullCheckingpublic void setFullChecking(boolean fullChecking) enable full schema checking. Slower but better.- Parameters:
- fullChecking- a- booleanvalue.
 
- 
createAnonymousSchemaprotected void createAnonymousSchema()create a schema location to hold the anonymous schema
- 
setNoNamespaceURLidentify the URL of the default schema- Parameters:
- defaultSchemaURL- the URL of the default schema.
 
- 
setNoNamespaceFileidentify a file containing the default schema- Parameters:
- defaultSchemaFile- the location of the default schema.
 
- 
setDisableDTDpublic void setDisableDTD(boolean disableDTD) flag to disable DTD support.- Parameters:
- disableDTD- a- booleanvalue.
 
- 
initValidatorprotected void initValidator()init the parser : load the parser class, and set features if necessary It is only after this that the reader is valid- Overrides:
- initValidatorin class- XMLValidateTask
- Throws:
- BuildException- if something went wrong
 
- 
createDefaultReaderCreate a reader if the use of the class did not specify another one. The reason to not useJAXPUtils.getXMLReader()was to create our own factory with our own options.- Overrides:
- createDefaultReaderin class- XMLValidateTask
- Returns:
- a default XML parser
 
- 
addSchemaLocationsprotected void addSchemaLocations()build a string list of all schema locations, then set the relevant property.
- 
getNoNamespaceSchemaURLget the URL of the no namespace schema- Returns:
- the schema URL
 
- 
setFeatureIfSupportedset a feature if it is supported, log at verbose level if not- Parameters:
- feature- the feature.
- value- a- booleanvalue.
 
- 
onSuccessfulValidationprotected void onSuccessfulValidation(int fileProcessed) handler called on successful file validation.- Overrides:
- onSuccessfulValidationin class- XMLValidateTask
- Parameters:
- fileProcessed- number of files processed.
 
 
-