jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java
changeset 39907 db51759e3695
parent 25868 686eef1e7a79
child 42247 52fafb950d5a
equal deleted inserted replaced
39906:230d872f56ea 39907:db51759e3695
     1 /*
     1 /*
     2  * reserved comment block
     2  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT REMOVE OR ALTER!
       
     4  */
     3  */
     5 /*
     4 /*
     6  * Copyright 2001-2004 The Apache Software Foundation.
     5  * Licensed to the Apache Software Foundation (ASF) under one or more
     7  *
     6  * contributor license agreements.  See the NOTICE file distributed with
     8  * Licensed under the Apache License, Version 2.0 (the "License");
     7  * this work for additional information regarding copyright ownership.
     9  * you may not use this file except in compliance with the License.
     8  * The ASF licenses this file to You under the Apache License, Version 2.0
    10  * You may obtain a copy of the License at
     9  * (the "License"); you may not use this file except in compliance with
       
    10  * the License.  You may obtain a copy of the License at
    11  *
    11  *
    12  *      http://www.apache.org/licenses/LICENSE-2.0
    12  *      http://www.apache.org/licenses/LICENSE-2.0
    13  *
    13  *
    14  * Unless required by applicable law or agreed to in writing, software
    14  * Unless required by applicable law or agreed to in writing, software
    15  * distributed under the License is distributed on an "AS IS" BASIS,
    15  * distributed under the License is distributed on an "AS IS" BASIS,
    45 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
    45 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
    46 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;
    46 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;
    47 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
    47 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
    48 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
    48 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
    49 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
    49 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
       
    50 import javax.xml.XMLConstants;
       
    51 import javax.xml.catalog.CatalogFeatures;
       
    52 import jdk.xml.internal.JdkXmlUtils;
    50 
    53 
    51 /**
    54 /**
    52  * This is the non validating parser configuration. It extends the basic
    55  * This is the non validating parser configuration. It extends the basic
    53  * configuration with the set of following parser components:
    56  * configuration with the set of following parser components:
    54  * Document scanner, DTD scanner, namespace binder, document handler.
    57  * Document scanner, DTD scanner, namespace binder, document handler.
   279                                        XMLComponentManager parentSettings) {
   282                                        XMLComponentManager parentSettings) {
   280         super(symbolTable, parentSettings);
   283         super(symbolTable, parentSettings);
   281 
   284 
   282         // add default recognized features
   285         // add default recognized features
   283         final String[] recognizedFeatures = {
   286         final String[] recognizedFeatures = {
   284                 PARSER_SETTINGS,
   287             PARSER_SETTINGS,
   285                         NAMESPACES,
   288             NAMESPACES,
   286             //WARN_ON_DUPLICATE_ATTDEF,     // from XMLDTDScannerImpl
   289             //WARN_ON_DUPLICATE_ATTDEF,     // from XMLDTDScannerImpl
   287             //WARN_ON_UNDECLARED_ELEMDEF,   // from XMLDTDScannerImpl
   290             //WARN_ON_UNDECLARED_ELEMDEF,   // from XMLDTDScannerImpl
   288             //ALLOW_JAVA_ENCODINGS,         // from XMLEntityManager
   291             //ALLOW_JAVA_ENCODINGS,         // from XMLEntityManager
   289             CONTINUE_AFTER_FATAL_ERROR,
   292             CONTINUE_AFTER_FATAL_ERROR,
   290             //LOAD_EXTERNAL_DTD,    // from XMLDTDScannerImpl
   293             //LOAD_EXTERNAL_DTD,    // from XMLDTDScannerImpl
   291             //NOTIFY_BUILTIN_REFS,  // from XMLDocumentFragmentScannerImpl
   294             //NOTIFY_BUILTIN_REFS,  // from XMLDocumentFragmentScannerImpl
   292             //NOTIFY_CHAR_REFS,         // from XMLDocumentFragmentScannerImpl
   295             //NOTIFY_CHAR_REFS,         // from XMLDocumentFragmentScannerImpl
   293             //WARN_ON_DUPLICATE_ENTITYDEF   // from XMLEntityManager
   296             //WARN_ON_DUPLICATE_ENTITYDEF   // from XMLEntityManager
       
   297             XMLConstants.USE_CATALOG
   294         };
   298         };
   295         addRecognizedFeatures(recognizedFeatures);
   299         addRecognizedFeatures(recognizedFeatures);
   296 
   300 
   297         // set state for default features
   301         // set state for default features
   298         //setFeature(WARN_ON_DUPLICATE_ATTDEF, false);  // from XMLDTDScannerImpl
   302         //setFeature(WARN_ON_DUPLICATE_ATTDEF, false);  // from XMLDTDScannerImpl
   299         //setFeature(WARN_ON_UNDECLARED_ELEMDEF, false);    // from XMLDTDScannerImpl
   303         //setFeature(WARN_ON_UNDECLARED_ELEMDEF, false);    // from XMLDTDScannerImpl
   300         //setFeature(ALLOW_JAVA_ENCODINGS, false);      // from XMLEntityManager
   304         //setFeature(ALLOW_JAVA_ENCODINGS, false);      // from XMLEntityManager
   301         fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
   305         fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
   302                 fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
   306         fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
   303                 fFeatures.put(NAMESPACES, Boolean.TRUE);
   307         fFeatures.put(NAMESPACES, Boolean.TRUE);
   304         //setFeature(LOAD_EXTERNAL_DTD, true);      // from XMLDTDScannerImpl
   308         //setFeature(LOAD_EXTERNAL_DTD, true);      // from XMLDTDScannerImpl
   305         //setFeature(NOTIFY_BUILTIN_REFS, false);   // from XMLDocumentFragmentScannerImpl
   309         //setFeature(NOTIFY_BUILTIN_REFS, false);   // from XMLDocumentFragmentScannerImpl
   306         //setFeature(NOTIFY_CHAR_REFS, false);      // from XMLDocumentFragmentScannerImpl
   310         //setFeature(NOTIFY_CHAR_REFS, false);      // from XMLDocumentFragmentScannerImpl
   307         //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);   // from XMLEntityManager
   311         //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);   // from XMLEntityManager
       
   312         fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
   308 
   313 
   309         // add default recognized properties
   314         // add default recognized properties
   310         final String[] recognizedProperties = {
   315         final String[] recognizedProperties = {
   311             ERROR_REPORTER,
   316             ERROR_REPORTER,
   312             ENTITY_MANAGER,
   317             ENTITY_MANAGER,
   317             XMLGRAMMAR_POOL,
   322             XMLGRAMMAR_POOL,
   318             DATATYPE_VALIDATOR_FACTORY,
   323             DATATYPE_VALIDATOR_FACTORY,
   319             VALIDATION_MANAGER,
   324             VALIDATION_MANAGER,
   320             LOCALE,
   325             LOCALE,
   321             SECURITY_MANAGER,
   326             SECURITY_MANAGER,
   322             XML_SECURITY_PROPERTY_MANAGER
   327             XML_SECURITY_PROPERTY_MANAGER,
       
   328             JdkXmlUtils.CATALOG_DEFER,
       
   329             JdkXmlUtils.CATALOG_FILES,
       
   330             JdkXmlUtils.CATALOG_PREFER,
       
   331             JdkXmlUtils.CATALOG_RESOLVE
   323         };
   332         };
   324         addRecognizedProperties(recognizedProperties);
   333         addRecognizedProperties(recognizedProperties);
   325 
   334 
   326         fGrammarPool = grammarPool;
   335         fGrammarPool = grammarPool;
   327         if(fGrammarPool != null){
   336         if(fGrammarPool != null){
   375             // do nothing
   384             // do nothing
   376             // REVISIT: What is the right thing to do? -Ac
   385             // REVISIT: What is the right thing to do? -Ac
   377         }
   386         }
   378 
   387 
   379         setProperty(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
   388         setProperty(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
       
   389 
       
   390         // Initialize Catalog features
       
   391         for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
       
   392             setProperty(f.getPropertyName(), null);
       
   393         }
   380     } // <init>(SymbolTable,XMLGrammarPool)
   394     } // <init>(SymbolTable,XMLGrammarPool)
   381 
   395 
   382     //
   396     //
   383     // Public methods
   397     // Public methods
   384     //
   398     //