You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2008/09/27 19:27:57 UTC

svn commit: r699694 - /xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java

Author: mrglavas
Date: Sat Sep 27 10:27:56 2008
New Revision: 699694

URL: http://svn.apache.org/viewvc?rev=699694&view=rev
Log:
Return true for each of the JAXP Source/Result features to indicate
to the caller of getFeature() that this Validator supports all of 
the built-in JAXP Source/Result types.

Modified:
    xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java?rev=699694&r1=699693&r2=699694&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java Sat Sep 27 10:27:56 2008
@@ -22,9 +22,13 @@
 
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXResult;
 import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Validator;
 
@@ -50,6 +54,11 @@
  */
 final class ValidatorImpl extends Validator implements PSVIProvider {
     
+    // feature identifiers
+    
+    /** JAXP Source/Result feature prefix. */
+    private static final String JAXP_SOURCE_RESULT_FEATURE_PREFIX = "http://javax.xml.transform";
+    
     // property identifiers
     
     /** Property identifier: Current element node. */
@@ -155,6 +164,19 @@
         if (name == null) {
             throw new NullPointerException();
         }
+        if (name.startsWith(JAXP_SOURCE_RESULT_FEATURE_PREFIX)) {
+            // Indicates to the caller that this Validator supports a specific JAXP Source or Result.
+            if (name.equals(StreamSource.FEATURE) ||
+                name.equals(SAXSource.FEATURE) ||
+                name.equals(DOMSource.FEATURE) ||
+                name.equals(StAXSource.FEATURE) ||
+                name.equals(StreamResult.FEATURE) ||
+                name.equals(SAXResult.FEATURE) ||
+                name.equals(DOMResult.FEATURE) ||
+                name.equals(StAXResult.FEATURE)) {
+                return true;
+            }
+        }
         try {
             return fComponentManager.getFeature(name);
         }
@@ -173,6 +195,20 @@
         if (name == null) {
             throw new NullPointerException();
         }
+        if (name.startsWith(JAXP_SOURCE_RESULT_FEATURE_PREFIX)) {
+            if (name.equals(StreamSource.FEATURE) ||
+                name.equals(SAXSource.FEATURE) ||
+                name.equals(DOMSource.FEATURE) ||
+                name.equals(StAXSource.FEATURE) ||
+                name.equals(StreamResult.FEATURE) ||
+                name.equals(SAXResult.FEATURE) ||
+                name.equals(DOMResult.FEATURE) ||
+                name.equals(StAXResult.FEATURE)) {
+                throw new SAXNotSupportedException(
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
+                        "feature-read-only", new Object [] {name}));
+            }
+        }
         try {
             fComponentManager.setFeature(name, value);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org