Index: src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java,v
retrieving revision 1.20
diff -u -r1.20 XMLValidateTask.java
--- src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java	9 Jul 2002 21:06:02 -0000	1.20
+++ src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java	11 Jul 2002 10:32:52 -0000
@@ -56,14 +56,12 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Vector;
-import java.util.Hashtable;
-import java.util.Enumeration;
+import java.util.List;
+import java.util.ArrayList;
+
 import org.apache.tools.ant.AntClassLoader;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
@@ -92,6 +90,8 @@
  * (probably the one that is used by Ant itself), but one can specify any
  * SAX1/2 parser if needed
  * @author Raphael Pierquin <a href="mailto:raphael.pierquin@agisphere.com">raphael.pierquin@agisphere.com</a>
+ * @author <a href="mailto:nick.pellow@mindmatics.de">Nick Pellow</a>
+ * Added support for setting features.
  */
 public class XMLValidateTask extends Task {
 
@@ -109,8 +109,7 @@
     protected Vector filesets = new Vector(); // sets of file to be validated
     protected Path classpath;
 
-
-    /**
+   /**
      * 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
@@ -119,7 +118,8 @@
     protected XMLReader xmlReader = null; // XMLReader used to validation process
     protected ValidatorErrorHandler errorHandler
         = new ValidatorErrorHandler(); // to report sax parsing errors
-    protected Hashtable features = new Hashtable();
+
+    private List featureList = new ArrayList();
 
     private XMLCatalog xmlCatalog = new XMLCatalog();
 
@@ -224,6 +224,13 @@
         filesets.addElement(set);
     }
 
+
+    public Feature createFeature() {
+        final Feature feature = new Feature();
+        featureList.add(feature);
+        return feature;
+    }
+
     public void init() throws BuildException {
         super.init();
         xmlCatalog.setProject(project);
@@ -349,18 +356,18 @@
                                              + " doesn't provide validation");
                 }
             }
-            // set other features
-            Enumeration enum = features.keys();
-            while (enum.hasMoreElements()) {
-                String featureId = (String) enum.nextElement();
-                setFeature(featureId, ((Boolean) features.get(featureId)).booleanValue(), true);
+            // set the feature from the feature list
+            for (int i = 0; i < featureList.size(); i++) {
+                Feature feature = (Feature) featureList.get(i);
+                setFeature(feature.getFeatureName(),
+                        feature.getFeatureValue(),
+                        true);
             }
         }
     }
 
     /**
-     * set a feature on the parser.
-     * @todo find a way to set any feature from build.xml
+     * Set a feature on the parser.
      */
     private boolean setFeature(String feature, boolean value, boolean warn) {
 
@@ -482,6 +489,51 @@
                 }
             }
             return e.getMessage();
+        }
+    }
+
+    /**
+     * The class to create to set a feature of the parser.
+     *
+     * @author <a href="mailto:nick.pellow@mindmatics.de">Nick Pellow</a>
+     */
+    public class Feature {
+        /** The name of the feature to set.
+         *
+         * Valid features <a href=http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html#package_description">include.</a>
+         */
+        private String mFeatureName = null;
+        /** The value of the feature. **/
+        private boolean mFeatureValue;
+        /**
+         * Set the feature name.
+         * @param aName the name to set
+         */
+        public void setName(String aName) {
+            mFeatureName = aName;
+        }
+        /**
+         * Set the feature value.
+         * @param aValue
+         */
+        public void setValue(boolean aValue) {
+            mFeatureValue = aValue;
+        }
+
+        /**
+         * Gets the feature name.
+         * @return the feature name
+         */
+        public String getFeatureName() {
+            return mFeatureName;
+        }
+
+        /**
+         * Gets the feature value.
+         * @return the featuree value
+         */
+        public boolean getFeatureValue() {
+            return mFeatureValue;
         }
     }
 }
Index: docs/manual/OptionalTasks/xmlvalidate.html
===================================================================
RCS file: /home/cvspublic/jakarta-ant/docs/manual/OptionalTasks/xmlvalidate.html,v
retrieving revision 1.6
diff -u -r1.6 xmlvalidate.html
--- docs/manual/OptionalTasks/xmlvalidate.html	9 Jul 2002 21:05:52 -0000	1.6
+++ docs/manual/OptionalTasks/xmlvalidate.html	11 Jul 2002 10:32:53 -0000
@@ -14,9 +14,11 @@
 (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 <a
-href="../CoreTypes/xmlcatalog.html">xmlcatalog</a> elements and/or nested
-<tt>&lt;dtd&gt;</tt> elements which are used to resolve DTDs and entities.</p>
+<p>This task supports the use of nested
+  <li/><a href="../CoreTypes/xmlcatalog.html"><tt>&lt;xmlcatalog&gt;</tt></a> elements 
+  <li/><tt>&lt;dtd&gt;</tt> elements which are used to resolve DTDs and entities.
+  <li/><tt>&lt;feature&gt;</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>
 
 <h3>Parameters</h3>
 <table border="1" cellpadding="2" cellspacing="0">
@@ -84,6 +86,12 @@
 <h4>xmlcatalog</h4>
 <p>The <a href="../CoreTypes/xmlcatalog.html">xmlcatalog</a>
 element is used to perform Entity resolution.</p>
+<h4>feature</h4>
+<p>The feature element is used to set SAX Parser features.
+There can 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>
+A feature essentialy changes the mode of the parser.
+</p>
 
 
 <h3>Examples</h3>
@@ -114,6 +122,16 @@
          location=&quot;com/arielpartners/knowledgebase/dtd/article.dtd&quot;/&gt;
   &lt;/xmlcatalog&gt;
 &lt;/xmlvalidate&gt;
+<br/>
+&lt;xmlvalidate failonerror="yes" lenient="no" warn="yes"&gt;
+
+  &lt;fileset dir="xml" includes="**/*.xml"/&gt;
+  &lt;feature name="http://xml.org/sax/features/validation" value="true"/&gt;
+  &lt;feature name="http://apache.org/xml/features/validation/schema"  value="true"/&gt;
+      
+&lt;/xmlvalidate&gt;
+      
+
 </pre></blockquote>
 <hr>
 

