@@ -9,17 +9,14 @@
<h2><a name="xmlvalidate">XMLValidate</a></h2>
<h2><a name="xmlvalidate">XMLValidate</a></h2>
<h3>Description</h3>
<h3>Description</h3>
<p>This task checks XML files are valid (or only well formed). The
<p>This task checks xml files are valid (or only well formed). The
task uses the SAX2 parser implementation provided by JAXP by default
task uses the SAX2 parser implementation provided by JAXP by default
(usually the one that is used by Ant itself), but one can specify any
SAX1/2 parser if needed. Ant ships with Xerces, which is also what is built in
to Java 1.4: XML parsers built into the runtime override Ant's choice.</p>
(probably the one that is used by Ant itself), but one can specify any
SAX1/2 parser if needed.</p>
<p>This task supports the use of nested
<li/><a href="../CoreTypes/xmlcatalog.html"><tt><xmlcatalog></tt></a> elements
<li/><tt><dtd></tt> elements which are used to resolve DTDs and other entities.
<li/><tt><feature></tt> elements which are used to set features. These can be any number of <a href="http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html#package_description">http://xml.org/sax/features/</a>
</p>
<p>This task supports the use of nested <a
href="../CoreTypes/xmlcatalog.html">xmlcatalog</a> elements and/or nested
<tt><dtd></tt> elements which are used to resolve DTDs and entities.</p>
<h3>Parameters</h3>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<table border="1" cellpadding="2" cellspacing="0">
@@ -65,7 +62,7 @@ to Java 1.4: XML parsers built into the runtime override Ant's choice.</p>
<h3><a name="nested">Nested Elements</a></h3>
<h3><a name="nested">Nested Elements</a></h3>
<h4>dtd</h4>
<h4>dtd</h4>
<dtd> is used to specify different locations for DTD and entity resolution.
<dtd> is used to specify different locations for DTD resolution.
<table border="1" cellpadding="2" cellspacing="0">
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<tr>
<td width="12%" valign="top"><b>Attribute</b></td>
<td width="12%" valign="top"><b>Attribute</b></td>
@@ -87,19 +84,14 @@ to Java 1.4: XML parsers built into the runtime override Ant's choice.</p>
<h4>xmlcatalog</h4>
<h4>xmlcatalog</h4>
<p>The <a href="../CoreTypes/xmlcatalog.html">xmlcatalog</a>
<p>The <a href="../CoreTypes/xmlcatalog.html">xmlcatalog</a>
element is used to perform Entity resolution.</p>
element is used to perform Entity resolution.</p>
<h4>feature</h4>
<p>The feature element is used to set SAX Parser features.
A feature essentialy changes the mode of the parser.
There can be an arbitrary amount of features set as defined here:
<a href="http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html#package_description">http://xml.org/sax/features/</a>
</p>
<h3>Examples</h3>
<h3>Examples</h3>
<pre>
<pre>
<xmlvalidate file="toto.xml"/>
<xmlvalidate file="toto.xml"/>
</pre>
Validate toto.xml
<pre>
<xmlvalidate failonerror="no" lenient="yes" warn="yes"
<xmlvalidate failonerror="no" lenient="yes" warn="yes"
classname="org.apache.xerces.parsers.SAXParser">
classname="org.apache.xerces.parsers.SAXParser">
classpath="lib/xerces.jar">
classpath="lib/xerces.jar">
@@ -108,8 +100,8 @@ There can be an arbitrary amount of features set as defined here:
</pre>
</pre>
Validate all .xsl files in src/style, but only warn if there is an error, rather than
Validate all .xsl files in src/style, but only warn if there is an error, rather than
halt the build.
halt the build.
<pre>
<pre>
<xmlvalidate file="struts-config.xml" warn="false">
<xmlvalidate file="struts-config.xml" warn="false">
<dtd publicId="-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
<dtd publicId="-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
location="struts-config_1_0.dtd"/>
location="struts-config_1_0.dtd"/>
@@ -117,8 +109,7 @@ halt the build.
</pre>
</pre>
Validate a struts configuration, using a local copy of the DTD.
Validate a struts configuration, using a local copy of the DTD.
<pre>
<pre>
<xmlvalidate failonerror="no">
<xmlvalidate failonerror="no">
<fileset dir="${project.dir}" includes="**/*.xml"/>
<fileset dir="${project.dir}" includes="**/*.xml"/>
<xmlcatalog refid="mycatalog"/>
<xmlcatalog refid="mycatalog"/>
@@ -127,7 +118,6 @@ Validate a struts configuration, using a local copy of the DTD.
Scan all XML files in the project, using a predefined catalog to map URIs to local files.
Scan all XML files in the project, using a predefined catalog to map URIs to local files.
<pre>
<pre>
<xmlvalidate failonerror="no">
<xmlvalidate failonerror="no">
<fileset dir="${project.dir}" includes="**/*.xml"/>
<fileset dir="${project.dir}" includes="**/*.xml"/>
<xmlcatalog>
<xmlcatalog>
@@ -137,22 +127,7 @@ Scan all XML files in the project, using a predefined catalog to map URIs to loc
</xmlcatalog>
</xmlcatalog>
</xmlvalidate>
</xmlvalidate>
</pre>
</pre>
Scan all XML files in the project, using the catalog defined inline.
Scan all XML files in the project, using the catalog defined inline.
<pre>
<xmlvalidate failonerror="yes" lenient="no" warn="yes">
<fileset dir="xml" includes="**/*.xml"/>
<feature name="http://xml.org/sax/features/validation" value="true"/>
<feature name="http://apache.org/xml/features/validation/schema" value="true"/>
</xmlvalidate>
</pre>
Validate the XML files using XML Schema validation.
<hr>
<hr>
<p align="center">Copyright © 2001-2002 Apache Software Foundation. All rights
<p align="center">Copyright © 2001-2002 Apache Software Foundation. All rights