Index: java/modules/extensions/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java
===================================================================
--- java/modules/extensions/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java	(revision 417504)
+++ java/modules/extensions/src/org/apache/synapse/config/xml/ValidateMediatorFactory.java	(working copy)
@@ -26,27 +26,33 @@
 import org.apache.synapse.mediators.ValidateMediator;
 import org.jaxen.JaxenException;
 
+import java.util.Iterator;
 import javax.xml.namespace.QName;
 
 /**
  * Creates a validation mediator from the XML configuration
  * <p/>
- * <validate schema="url" [source="xpath"]>
- * <on-fail>
- * mediator+
- * </on-fail>
+ * <validate schema="url">
+ *   <property name="<validation-feature-id>" value="true|false"/> +
+ *   <on-fail>
+ *     mediator+
+ *   </on-fail>
  * </validate>
  */
 public class ValidateMediatorFactory extends AbstractListMediatorFactory {
 
     private static final Log log = LogFactory.getLog(TransformMediatorFactory.class);
+
     private static final QName VALIDATE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "validate");
+    private static final QName ON_FAIL_Q = new QName(Constants.SYNAPSE_NAMESPACE, "on-fail");
+    private static final QName SCHEMA_Q = new QName(Constants.NULL_NAMESPACE, "schema");
+    private static final QName SOURCE_Q = new QName(Constants.NULL_NAMESPACE, "source");
 
     public Mediator createMediator(OMElement elem) {
 
         ValidateMediator validateMediator = new ValidateMediator();
-        OMAttribute attSchema = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "schema"));
-        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+        OMAttribute attSchema = elem.getAttribute(SCHEMA_Q);
+        OMAttribute attSource = elem.getAttribute(SOURCE_Q);
 
         if (attSchema != null) {
             validateMediator.setSchemaUrl(attSchema.getAttributeValue());
@@ -61,7 +67,6 @@
                 AXIOMXPath xp = new AXIOMXPath(attSource.getAttributeValue());
                 validateMediator.setSource(xp);
                 Util.addNameSpaces(xp, elem, log);
-
             } catch (JaxenException e) {
                 String msg = "Invalid XPath expression specified for attribute 'source'";
                 log.error(msg);
@@ -69,17 +74,22 @@
             }
         }
 
-        OMElement onFail = elem.getFirstElement();
-        if (new QName(Constants.SYNAPSE_NAMESPACE, "on-fail").equals(onFail.getQName()) &&
-            onFail.getChildElements().hasNext()) {
+        OMElement onFail = null;
+        Iterator iter = elem.getChildrenWithName(ON_FAIL_Q);
+        if (iter.hasNext()) {
+            onFail = (OMElement)iter.next();
+        }
+
+        if (onFail != null && onFail.getChildElements().hasNext()) {
             super.addChildren(onFail, validateMediator);
-
         } else {
-            String msg = "A non-empty on-fail element is required for the validate mediator";
+            String msg = "A non-empty <on-fail> child element is required for the <validate> mediator";
             log.error(msg);
             throw new SynapseException(msg);
         }
 
+        validateMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
         return validateMediator;
     }
 
Index: java/modules/extensions/src/org/apache/synapse/mediators/ValidateMediator.java
===================================================================
--- java/modules/extensions/src/org/apache/synapse/mediators/ValidateMediator.java	(revision 417504)
+++ java/modules/extensions/src/org/apache/synapse/mediators/ValidateMediator.java	(working copy)
@@ -44,38 +44,36 @@
 import javax.xml.validation.Validator;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 import java.util.StringTokenizer;
 
 /**
  * Validate a message or an element against a schema
  */
-public class ValidateMediator extends AbstractListMediator {
-
+public class ValidateMediator extends AbstractListMediator 
+{
     private static final Log log = LogFactory.getLog(ValidateMediator.class);
 
-    /** A space or comma delimitered list of schemas to validate the source element against */
-    private String schemaUrl = null;
     /**
-     * An XPath expression to be evaluated against the message to find the element to be validated.
-     * If this is not specified, the validation will occur against the first child element of the SOAP body
+     * Default validation schema language (http://www.w3.org/2001/XMLSchema) and validator feature ids.
      */
-    private AXIOMXPath source = null;
+    private static final String DEFAULT_SCHEMA_LANGUAGE = "http://www.w3.org/2001/XMLSchema";
 
-    /**
-     * Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking).
+    /** 
+     * A space or comma delimitered list of schemas to validate the source element against 
      */
-    private static final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http://apache.org/xml/features/validation/schema-full-checking";
+    private String schemaUrl = null;
 
     /**
-     * Honour all schema locations feature id (http://apache.org/xml/features/honour-all-schemaLocations).
+     * An XPath expression to be evaluated against the message to find the element to be validated.
+     * If this is not specified, the validation will occur against the first child element of the SOAP body
      */
-    private static final String HONOUR_ALL_SCHEMA_LOCATIONS_ID = "http://apache.org/xml/features/honour-all-schemaLocations";
+    private AXIOMXPath source = null;
 
-    /**
-     * Default schema language (http://www.w3.org/2001/XMLSchema).
-     */
-    private static final String DEFAULT_SCHEMA_LANGUAGE = "http://www.w3.org/2001/XMLSchema";
+    private Map properties = new HashMap();
 
 
     public String getSchemaUrl() {
@@ -164,8 +162,7 @@
             // Create SchemaFactory and configure
             SchemaFactory factory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
             factory.setErrorHandler(handler);
-            factory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
-            factory.setFeature(HONOUR_ALL_SCHEMA_LOCATIONS_ID, true);
+            setXmlFeatures(factory);
 
             // Build Schema from schemaUrl
             Schema schema = null;
@@ -188,11 +185,10 @@
                 schema = factory.newSchema();
             }
 
-            // Setup validator and input source.
+            // Setup validator and input source 
+            // Features set for the SchemaFactory get propagated to Schema and Validator (JAXP 1.4).
             Validator validator = schema.newValidator();
             validator.setErrorHandler(handler);
-            validator.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
-            validator.setFeature(HONOUR_ALL_SCHEMA_LOCATIONS_ID, true);
 
             XMLReader reader = XMLReaderFactory.createXMLReader();
             SAXSource source = new SAXSource(reader, new InputSource(baisFromSource));
@@ -216,6 +212,31 @@
         return true;
     }
 
+    public Object getProperty(String key) {
+        return properties.get(key);
+    }
+
+    public void setProperty(String key, Object value) {
+        properties.put(key, value);
+    }
+
+    public void addAllProperties(List list) {
+        Iterator iter = list.iterator();
+        while (iter.hasNext()) {
+            MediatorProperty prop = (MediatorProperty) iter.next();
+            setProperty(prop.getName(), prop.getValue());
+        }
+    }
+
+    private void setXmlFeatures(SchemaFactory factory) throws SAXException {
+        Iterator iter = properties.entrySet().iterator();
+        while (iter.hasNext()) {
+            Map.Entry entry = (Map.Entry)iter.next();
+            String value = (String)entry.getValue();
+            factory.setFeature((String)entry.getKey(), value != null && "true".equals(value));
+        }
+    }
+
     /**
      * This class handles validation errors to be used for error reporting
      */
Index: java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java
===================================================================
--- java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java	(revision 417504)
+++ java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java	(working copy)
@@ -15,16 +15,28 @@
 */
 package org.apache.synapse;
 
+import java.io.ByteArrayInputStream;
+import javax.xml.stream.XMLStreamException;
 import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.xpath.AXIOMXPath;
 import org.apache.synapse.MessageContext;
 import org.apache.synapse.TestMediateHandler;
 import org.apache.synapse.TestMediator;
 import org.apache.synapse.mediators.TestUtils;
 import org.apache.synapse.mediators.ValidateMediator;
+import org.apache.synapse.config.xml.ValidateMediatorFactory;
 
-public class ValidateMediatorTest extends TestCase {
+public class ValidateMediatorTest extends TestCase 
+{
 
+    private static final String SCHEMA_FULL_CHECKING_FEATURE_ID = 
+        "http://apache.org/xml/features/validation/schema-full-checking";
+
+    private static final String HONOUR_ALL_SCHEMA_LOCATIONS_FEATURE_ID = 
+        "http://apache.org/xml/features/honour-all-schemaLocations";
+
     private static final String VALID_ENVELOPE_TWO_SCHEMAS =
             "<Outer xmlns=\"http://www.apache-synapse.org/test2\">" +
             "<m0:CheckPriceRequest xmlns:m0=\"http://www.apache-synapse.org/test\">\n" +
@@ -65,6 +77,30 @@
             "<Codes>String</Codes>\n" +
             "</CheckPriceRequest>\n";
 
+    private static final String DEFAULT_FEATURES_MEDIATOR_CONFIG = 
+            "<validate xmlns=\"http://ws.apache.org/ns/synapse\" " +
+            "       schema=\"file:synapse_repository/conf/sample/validate.xsd\">" + 
+            "   <on-fail>" +
+            "       <makefault>" +
+            "           <code value=\"tns:Receiver\" xmlns:tns=\"http://www.w3.org/2003/05/soap-envelope\"/>" +
+            "           <reason value=\"Invalid request\"/>" +
+            "       </makefault>" +
+            "   </on-fail>" +
+            "</validate>";
+
+    private static final String CUSTOM_FEATURES_MEDIATOR_CONFIG = 
+            "<validate xmlns=\"http://ws.apache.org/ns/synapse\" " +
+            "       schema=\"file:synapse_repository/conf/sample/validate.xsd\">" + 
+            "   <property name=\"" + SCHEMA_FULL_CHECKING_FEATURE_ID + "\" value=\"false\"/>" +
+            "   <property name=\"" + HONOUR_ALL_SCHEMA_LOCATIONS_FEATURE_ID + "\" value=\"true\"/>" +
+            "   <on-fail>" +
+            "       <makefault>" +
+            "           <code value=\"tns:Receiver\" xmlns:tns=\"http://www.w3.org/2003/05/soap-envelope\"/>" +
+            "           <reason value=\"Invalid request\"/>" +
+            "       </makefault>" +
+            "   </on-fail>" +
+            "</validate>";
+
     private boolean onFailInvoked = false;
     private TestMediator testMediator = null;
 
@@ -82,7 +118,7 @@
         this.onFailInvoked = onFailInvoked;
     }
 
-    public void testValidateMedaitorValidCase() throws Exception {
+    public void testValidateMediatorValidCase() throws Exception {
         setOnFailInvoked(false);
 
         // create a validate mediator
@@ -100,10 +136,10 @@
         // test validate mediator, with static enveope
         validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE));
 
-        assertTrue(!onFailInvoked);
+        assertFalse(onFailInvoked);
     }
 
-    public void testValidateMedaitorValidCaseTwoSchemas() throws Exception {
+    public void testValidateMediatorValidCaseTwoSchemas() throws Exception {
         setOnFailInvoked(false);
 
         // create a validate mediator
@@ -121,10 +157,10 @@
         // test validate mediator, with static enveope
         validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE_TWO_SCHEMAS));
 
-        assertTrue(!onFailInvoked);
+        assertFalse(onFailInvoked);
     }
 
-    public void testValidateMedaitorInvalidCaseTwoSchemas() throws Exception {
+    public void testValidateMediatorInvalidCaseTwoSchemas() throws Exception {
         setOnFailInvoked(false);
 
         // create a validate mediator
@@ -145,7 +181,7 @@
         assertTrue(onFailInvoked);
     }
 
-    public void testValidateMedaitorInvalidCase() throws Exception {
+    public void testValidateMediatorInvalidCase() throws Exception {
         setOnFailInvoked(false);
 
         // create a validate mediator
@@ -166,7 +202,7 @@
         assertTrue(onFailInvoked);
     }
 
-    public void testValidateMedaitorValidCaseNoNS() throws Exception {
+    public void testValidateMediatorValidCaseNoNS() throws Exception {
         setOnFailInvoked(false);
 
         // create a validate mediator
@@ -184,10 +220,10 @@
         // test validate mediator, with static enveope
         validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE_NO_NS));
 
-        assertTrue(!onFailInvoked);
+        assertFalse(onFailInvoked);
     }
 
-    public void testValidateMedaitorInvalidCaseNoNS() throws Exception {
+    public void testValidateMediatorInvalidCaseNoNS() throws Exception {
         setOnFailInvoked(false);
 
         // create a validate mediator
@@ -207,4 +243,60 @@
 
         assertTrue(onFailInvoked);
     }
+
+    public void testValidateMediatorDefaultFeatures() throws Exception {
+
+        ValidateMediatorFactory mf = new ValidateMediatorFactory();
+        ValidateMediator validate = (ValidateMediator)mf.createMediator(
+            createOMElement(DEFAULT_FEATURES_MEDIATOR_CONFIG));
+
+        assertNull(validate.getProperty(SCHEMA_FULL_CHECKING_FEATURE_ID));
+        assertNull(validate.getProperty(HONOUR_ALL_SCHEMA_LOCATIONS_FEATURE_ID));
+
+        makeValidInvocation(validate);
+    }
+
+    public void testValidateMediatorCustomFeatures() throws Exception 
+    {
+        ValidateMediatorFactory mf = new ValidateMediatorFactory();
+        ValidateMediator validate = (ValidateMediator)mf.createMediator(
+            createOMElement(CUSTOM_FEATURES_MEDIATOR_CONFIG));
+
+        assertNotNull(validate.getProperty(SCHEMA_FULL_CHECKING_FEATURE_ID));
+        assertFalse("true".equals((String)validate.getProperty(SCHEMA_FULL_CHECKING_FEATURE_ID)));
+        assertNotNull(validate.getProperty(HONOUR_ALL_SCHEMA_LOCATIONS_FEATURE_ID));
+        assertTrue("true".equals((String)validate.getProperty(HONOUR_ALL_SCHEMA_LOCATIONS_FEATURE_ID)));
+
+        makeValidInvocation(validate);
+    }
+
+    private void makeValidInvocation(ValidateMediator validate) throws Exception {
+
+        setOnFailInvoked(false);
+
+        // set the schema url, source xpath and any name spaces
+        validate.setSchemaUrl("../core/test-resources/misc/validate.xsd");
+        AXIOMXPath source = new AXIOMXPath("//m0:CheckPriceRequest");
+        source.addNamespace("m0", "http://www.apache-synapse.org/test");
+        validate.setSource(source);
+
+        // set dummy mediator to be called on fail
+        validate.removeChild(0);
+        validate.addChild(testMediator);
+
+        // test validate mediator, with static enveope
+        validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE));
+
+        assertFalse(onFailInvoked);
+    }
+
+    private static OMElement createOMElement(String xml) {
+        try {
+            StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(xml.getBytes()));
+            OMElement omElement = builder.getDocumentElement();
+            return omElement;
+        } catch (XMLStreamException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }
