jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
changeset 20968 dde41f8b7b96
parent 20967 d3f1925927e5
child 20973 cc1cc8eb501b
equal deleted inserted replaced
20967:d3f1925927e5 20968:dde41f8b7b96
    17  * See the License for the specific language governing permissions and
    17  * See the License for the specific language governing permissions and
    18  * limitations under the License.
    18  * limitations under the License.
    19  */
    19  */
    20 
    20 
    21 package com.sun.org.apache.xerces.internal.parsers;
    21 package com.sun.org.apache.xerces.internal.parsers;
       
    22 
       
    23 import java.io.IOException;
       
    24 import java.util.ArrayList;
       
    25 import java.util.HashMap;
       
    26 import java.util.Locale;
       
    27 import javax.xml.XMLConstants;
    22 
    28 
    23 import com.sun.org.apache.xerces.internal.impl.Constants;
    29 import com.sun.org.apache.xerces.internal.impl.Constants;
    24 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
    30 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
    25 import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl;
    31 import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl;
    26 import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl;
    32 import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl;
    44 import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter;
    50 import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter;
    45 import com.sun.org.apache.xerces.internal.util.FeatureState;
    51 import com.sun.org.apache.xerces.internal.util.FeatureState;
    46 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
    52 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
    47 import com.sun.org.apache.xerces.internal.util.PropertyState;
    53 import com.sun.org.apache.xerces.internal.util.PropertyState;
    48 import com.sun.org.apache.xerces.internal.util.SymbolTable;
    54 import com.sun.org.apache.xerces.internal.util.SymbolTable;
       
    55 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
    49 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
    56 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
    50 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
    57 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
    51 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
    58 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
    52 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
    59 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
    53 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
    60 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
    61 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
    68 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
    62 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
    69 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
    63 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
    70 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
    64 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
    71 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
    65 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
    72 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
    66 import java.io.IOException;
       
    67 import java.util.ArrayList;
       
    68 import java.util.HashMap;
       
    69 import java.util.Locale;
       
    70 import javax.xml.XMLConstants;
       
    71 
    73 
    72 /**
    74 /**
    73  * This class is the configuration used to parse XML 1.0 and XML 1.1 documents.
    75  * This class is the configuration used to parse XML 1.0 and XML 1.1 documents.
    74  *
    76  *
    75  * @author Elena Litani, IBM
    77  * @author Elena Litani, IBM
   276 
   278 
   277     /** Property identifier: Security property manager. */
   279     /** Property identifier: Security property manager. */
   278     private static final String XML_SECURITY_PROPERTY_MANAGER =
   280     private static final String XML_SECURITY_PROPERTY_MANAGER =
   279             Constants.XML_SECURITY_PROPERTY_MANAGER;
   281             Constants.XML_SECURITY_PROPERTY_MANAGER;
   280 
   282 
       
   283     /** Property identifier: Security manager. */
       
   284     private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
   281 
   285 
   282     // debugging
   286     // debugging
   283 
   287 
   284     /** Set to true and recompile to print exception stack trace. */
   288     /** Set to true and recompile to print exception stack trace. */
   285     protected static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
   289     protected static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
   481                 EXTERNAL_GENERAL_ENTITIES,
   485                 EXTERNAL_GENERAL_ENTITIES,
   482                 EXTERNAL_PARAMETER_ENTITIES,
   486                 EXTERNAL_PARAMETER_ENTITIES,
   483                 PARSER_SETTINGS,
   487                 PARSER_SETTINGS,
   484                 XMLConstants.FEATURE_SECURE_PROCESSING
   488                 XMLConstants.FEATURE_SECURE_PROCESSING
   485                         };
   489                         };
   486 
       
   487         addRecognizedFeatures(recognizedFeatures);
   490         addRecognizedFeatures(recognizedFeatures);
   488         // set state for default features
   491         // set state for default features
   489         fFeatures.put(VALIDATION, Boolean.FALSE);
   492         fFeatures.put(VALIDATION, Boolean.FALSE);
   490         fFeatures.put(NAMESPACES, Boolean.TRUE);
   493         fFeatures.put(NAMESPACES, Boolean.TRUE);
   491         fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
   494         fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
   529                 //       not-recognized exception to be thrown. -Ac
   532                 //       not-recognized exception to be thrown. -Ac
   530                 SCHEMA_LOCATION,
   533                 SCHEMA_LOCATION,
   531                 SCHEMA_NONS_LOCATION,
   534                 SCHEMA_NONS_LOCATION,
   532                 LOCALE,
   535                 LOCALE,
   533                 SCHEMA_DV_FACTORY,
   536                 SCHEMA_DV_FACTORY,
       
   537                 SECURITY_MANAGER,
   534                 XML_SECURITY_PROPERTY_MANAGER
   538                 XML_SECURITY_PROPERTY_MANAGER
   535         };
   539         };
   536         addRecognizedProperties(recognizedProperties);
   540         addRecognizedProperties(recognizedProperties);
   537 
   541 
   538                 if (symbolTable == null) {
   542                 if (symbolTable == null) {
   578                 fProperties.put(VALIDATION_MANAGER, fValidationManager);
   582                 fProperties.put(VALIDATION_MANAGER, fValidationManager);
   579 
   583 
   580         fVersionDetector = new XMLVersionDetector();
   584         fVersionDetector = new XMLVersionDetector();
   581 
   585 
   582         fProperties.put(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
   586         fProperties.put(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
       
   587 
       
   588         fProperties.put(SECURITY_MANAGER, new XMLSecurityManager(true));
   583 
   589 
   584         // add message formatters
   590         // add message formatters
   585         if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
   591         if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
   586             XMLMessageFormatter xmft = new XMLMessageFormatter();
   592             XMLMessageFormatter xmft = new XMLMessageFormatter();
   587             fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
   593             fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);