You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2010/05/16 21:48:30 UTC

svn commit: r944900 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXParserConfiguration.java

Author: veithen
Date: Sun May 16 19:48:30 2010
New Revision: 944900

URL: http://svn.apache.org/viewvc?rev=944900&view=rev
Log:
AXIS2-4450: Added a StAXParserConfiguration specific to SOAP. It configures the parser to throw an exception when a DTD is encountered.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXParserConfiguration.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXParserConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXParserConfiguration.java?rev=944900&r1=944899&r2=944900&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXParserConfiguration.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXParserConfiguration.java Sun May 16 19:48:30 2010
@@ -99,6 +99,23 @@ public interface StAXParserConfiguration
     };
     
     /**
+     * Configuration suitable for SOAP messages. This will configure the parser
+     * to throw an exception when it encounters a document type declaration. The
+     * SOAP 1.1 specification indeed prescribes that
+     * "A SOAP message MUST NOT contain a Document Type Declaration." The
+     * difference between the {@link #STANDALONE} configuration and this
+     * configuration is that with {@link #STANDALONE}, the parser silently
+     * ignores references to external entities but doesn't throw any exception.
+     * 
+     * @see StAXDialect#disallowDoctypeDecl(XMLInputFactory)
+     */
+    StAXParserConfiguration SOAP = new StAXParserConfiguration() {
+        public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) {
+            return dialect.disallowDoctypeDecl(factory);
+        }
+    };
+    
+    /**
      * Apply the configuration to the given factory. The method MAY optionally
      * wrap the factory, e.g. to modify the behavior of the
      * {@link javax.xml.stream.XMLStreamReader} instances created by the