Author: mrglavas
Date: Wed Nov 22 13:17:33 2006
New Revision: 478323

URL: http://svn.apache.org/viewvc?view=rev&rev=478323
Log:
JIRA Issue #1204:
http://issues.apache.org/jira/browse/XERCESJ-1204

Allow an XMLEntityResolver to be set directly on a Document's DOMConfiguration.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java?view=diff&rev=478323&r1=478322&r2=478323
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DOMConfigurationImpl.java Wed 
Nov 22 13:17:33 2006
@@ -495,9 +495,7 @@
      *                 uninstall the currently installed resolver.
      */
     public void setEntityResolver(XMLEntityResolver resolver) {
-        if (resolver !=null) {
-            fProperties.put(ENTITY_RESOLVER, resolver);
-        }
+        fProperties.put(ENTITY_RESOLVER, resolver);
     } // setEntityResolver(XMLEntityResolver)
 
     /**
@@ -816,6 +814,22 @@
                 }
 
             }
+            else if (name.equalsIgnoreCase(ENTITY_RESOLVER)) {
+                if (value instanceof XMLEntityResolver || value == null) {
+                    try {
+                        setEntityResolver((XMLEntityResolver) value);
+                    }
+                    catch (XMLConfigurationException e) {}
+                }
+                else {
+                    String msg =
+                        DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "TYPE_MISMATCH_ERR",
+                            new Object[] { name });
+                    throw new DOMException(DOMException.TYPE_MISMATCH_ERR, 
msg);
+                }
+            }
             else if (name.equalsIgnoreCase(SYMBOL_TABLE)){
                 // Xerces Symbol Table
                 if (value instanceof SymbolTable){
@@ -933,6 +947,9 @@
                else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)) {
                        return getProperty(Constants.JAXP_PROPERTY_PREFIX + 
Constants.SCHEMA_SOURCE);
                }
+        else if (name.equalsIgnoreCase(ENTITY_RESOLVER)) {
+            return getEntityResolver();
+        }
         else if (name.equalsIgnoreCase(SYMBOL_TABLE)){
             return getProperty(SYMBOL_TABLE);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to