org.apache.tools.ant.taskdefs.optional
public class XMLValidateTask extends Task
Nested Class Summary | |
---|---|
static class | XMLValidateTask.Attribute
The class to create to set a feature of the parser. |
static class | XMLValidateTask.Property
A Parser property.
|
protected class | XMLValidateTask.ValidatorErrorHandler
ValidatorErrorHandler role :
|
Field Summary | |
---|---|
protected Path | classpath |
protected XMLValidateTask.ValidatorErrorHandler | errorHandler |
protected boolean | failOnError |
protected File | file file to be validated |
protected Vector | filesets sets of file to be validated |
protected static String | INIT_FAILED_MSG |
protected boolean | lenient |
static String | MESSAGE_FILES_VALIDATED Message for sucessfull validation |
protected String | readerClassName |
protected boolean | warn |
protected XMLReader | xmlReader
the parser is viewed as a SAX2 XMLReader. |
Method Summary | |
---|---|
void | addConfiguredXMLCatalog(XMLCatalog catalog)
add an XMLCatalog as a nested element; optional. |
void | addFileset(FileSet set)
specify a set of file to be checked |
protected void | cleanup()
Cleans up resources.
|
XMLValidateTask.Attribute | createAttribute()
Add an attribute nested element. |
Path | createClasspath() |
protected XMLReader | createDefaultReader()
create a reader if the use of the class did not specify another one.
|
DTDLocation | createDTD()
Create a DTD location record; optional.
|
XMLValidateTask.Property | createProperty()
Creates a property.
|
protected XMLReader | createXmlReader()
create the XML reader.
|
protected boolean | doValidate(File afile)
parse the file |
void | execute()
execute the task |
protected EntityResolver | getEntityResolver()
accessor to the xmlCatalog used in the task |
protected XMLReader | getXmlReader()
get the XML reader. |
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 boolean | isSax1Parser()
test that returns true if we are using a SAX1 parser. |
protected void | onSuccessfulValidation(int fileProcessed)
handler called on successful file validation. |
void | setClassName(String className)
Specify the class name of the SAX parser to be used. (optional) |
void | setClasspath(Path classpath)
Specify the classpath to be searched to load the parser (optional) |
void | setClasspathRef(Reference r)
Where to find the parser class; optional. |
void | setFailOnError(boolean fail)
Specify how parser error are to be handled.
|
protected void | setFeature(String feature, boolean value)
Set a feature on the parser. |
void | setFile(File file)
specify the file to be checked; optional. |
void | setLenient(boolean bool)
Specify whether the parser should be validating. |
protected void | setProperty(String name, String value)
Sets a property.
|
void | setWarn(boolean bool)
Specify how parser error are to be handled.
|
Parameters: catalog XMLCatalog to use
Parameters: set the fileset to check
Since: Ant 1.8.0
Returns: attribute created
Since: ant1.6
Returns: the classpath created
See Also: XMLValidateTask
Returns: a new reader.
Throws: BuildException if something went wrong
Returns: created DTD location
Returns: a property.
Since: ant 1.6.2
Returns: the new XMLReader.
Parameters: afile the file to validate.
Returns: true if the file validates.
Throws: BuildException if failonerror
is true and an error happens
Returns: xmlCatalog reference
Returns: the XML reader or null.
Throws: BuildException if something goes wrong with the build
Throws: BuildException if something went wrong
Returns: true when a SAX1 parser is in use
Parameters: fileProcessed number of files processed.
Parameters: className should be an implementation of SAX2
if className is an implementation of
if not set, the default will be used.org.xml.sax.XMLReader
or SAX2 org.xml.sax.Parser
.
org.xml.sax.Parser
, XMLValidateTask,
will be ignored.
See Also: org.xml.sax.XMLReader org.xml.sax.Parser
Parameters: classpath the classpath to load the parser
Parameters: r reference to a classpath defined elsewhere
See Also: XMLValidateTask
true
.
If set to true
(default), throw a buildException if the
parser yields an error.
Parameters: fail if set to false
do not fail on error
Parameters: feature the name of the feature to set value the value of the feature
Throws: BuildException if the feature was not supported
Parameters: file the file to be checked
true
.
If set to false, the validation will fail only if the parsed document is not well formed XML.
this option is ignored if the specified class with setClassName is not a SAX2 XMLReader.
Parameters: bool if set to false
only fail on malformed XML
Parameters: name a property name value a property value.
Throws: BuildException if an error occurs. BuildException if the property was not supported
If set to Parameters: bool if set to true (default), log a warn message for each SAX warn event.
false
do not send warnings