Hi,
Attached is a task that checks xml files are valid (or
only well formed).
The task uses crimson SAX2 parser implementation by default,
but one can specify any SAX1/2 parser if needed :
<xmlvalidate file="toto.xml"/>
<xmlvalidate failonerror="no" lenient="yes" warn="yes"
classname="org.apache.xerces.parsers.SAXParser" >
classpath="lib/xerces.jar">
<fileset dir="src" includes="style/*.xsl"/>
</xmlvalidate>
Supported properties/subelements are :
- file/embedded fileset : the file(s) you want to check
- lenient : if true, only check the xml document is well formed
(ignored if the specified parser is as SAX1 parser)
- classname : the parser to use. (default: crimson)
- classpathref/embedded classpath : where to find the parser class
- failonerror : try and guess... (default: true)
- warn: if true, log parser warn events
I don't know if the task should be optional or not, feel free
to rename the package if you think it's worth shipping with ant.
--
Raphael PIERQUIN
AGISphere S.A.
raphael.pierquin@agisphere.com
|