Checks XML files are valid (or only well formed). The
task uses the SAX2 parser implementation provided by JAXP by default
(probably the one that is used by Ant itself), but one can specify any
SAX1/2 parser if needed.
Inner Class :protected class ValidatorErrorHandler implements ErrorHandler
the parser is viewed as a SAX2 XMLReader. If a SAX1 parser is specified,
it's wrapped in an adapter that make it behave as a XMLReader.
a more 'standard' way of doing this would be to use the JAXP1.1 SAXParser
interface.
Add an attribute nested element. This is used for setting arbitrary
features of the SAX parser.
Valid attributes
include
attribute created since: ant1.6
create a reader if the use of the class did not specify another one.
If a BuildException is thrown, the caller may revert to an alternate
reader.
a new reader. throws: BuildException - if something went wrong
create the XML reader.
This is one by instantiating anything specified by
XMLValidateTask.readerClassName ,
falling back to a default reader if not.
If the returned reader is an instance of
ParserAdapter then
we have created and wrapped a SAX1 parser.
the new XMLReader.
init the parser :
load the parser class, and set features if necessary
It is only after this that the reader is valid
throws: BuildException - if something went wrong
Specify the class name of the SAX parser to be used. (optional)
Parameters: className - should be an implementation of SAX2org.xml.sax.XMLReader or SAX2 org.xml.sax.Parser.
Set a feature on the parser.
Parameters: feature - the name of the feature to set Parameters: value - the value of the feature throws: BuildException - if the feature was not supported
Specify whether the parser should be validating. Default
is 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
XMLValidateTask.setClassName(String) is not a SAX2 XMLReader.
Parameters: bool - if set to false only fail on malformed XML
Sets a property.
Parameters: name - a property name Parameters: value - a property value. throws: BuildException - if an error occurs. throws: BuildException - if the property was not supported