org.apache.tools.ant.taskdefs.optional
public class XMLValidateTask extends Task
Nested Class Summary | |
---|---|
class | XMLValidateTask.Attribute
The class to create to set a feature of the parser. |
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 |
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 |
XMLValidateTask.Attribute | createAttribute()
Add an attribute nested element. |
Path | createClasspath() |
DTDLocation | createDTD()
Create a DTD location record; optional.
|
XMLValidateTask.Property | createProperty()
Creates a property.
|
void | execute()
execute the task |
protected EntityResolver | getEntityResolver()
accessor to the xmlCatalog used in the task |
void | init()
Called by the project to let the task initialize properly.
|
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.
|
void | setFile(File file)
specify the file to be checked; optional. |
void | setLenient(boolean bool)
Specify whether the parser should be validating. |
void | setWarn(boolean bool)
Specify how parser error are to be handled.
|
Parameters: catalog XMLCatalog to use
Parameters: set the fileset to check
Returns: attribute created
Since: ant1.6
Returns: the classpath created
See Also: XMLValidateTask
Returns: created DTD location
Returns: a property.
Since: ant 1.6.2
Throws: BuildException if failonerror
is true and an error happens
Returns: xmlCatalog reference
Throws: BuildException if something goes wrong with the build
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
, {@link #setLenient(boolean)},
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: 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 {@link #setClassName(String)} is not a SAX2 XMLReader.
Parameters: bool if set to false
only fail on malformed XML
If set to Parameters: bool if set to true (default), log a warn message for each SAX warn event.
false
do not send warnings