jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
changeset 17534 21dc0b2762da
parent 16953 a44e04deb948
child 17645 d2f0e76ff056
equal deleted inserted replaced
17533:93a2cadbbd33 17534:21dc0b2762da
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2006, 2013 Oracle and/or its affiliates. All rights reserved.
     3  */
     3  */
     4 
     4 
     5 /*
     5 /*
     6  * Copyright 2005 The Apache Software Foundation.
     6  * Copyright 2005 The Apache Software Foundation.
     7  *
     7  *
    18  * limitations under the License.
    18  * limitations under the License.
    19  */
    19  */
    20 
    20 
    21 package com.sun.org.apache.xerces.internal.impl ;
    21 package com.sun.org.apache.xerces.internal.impl ;
    22 
    22 
       
    23 import com.sun.org.apache.xerces.internal.impl.Constants;
       
    24 import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
       
    25 import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
       
    26 import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
       
    27 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
       
    28 import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
       
    29 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
       
    30 import com.sun.org.apache.xerces.internal.util.*;
       
    31 import com.sun.org.apache.xerces.internal.util.SecurityManager;
       
    32 import com.sun.org.apache.xerces.internal.util.URI;
       
    33 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
       
    34 import com.sun.org.apache.xerces.internal.xni.Augmentations;
       
    35 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
       
    36 import com.sun.org.apache.xerces.internal.xni.XNIException;
       
    37 import com.sun.org.apache.xerces.internal.xni.parser.*;
       
    38 import com.sun.xml.internal.stream.Entity;
    23 import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
    39 import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
    24 import com.sun.xml.internal.stream.StaxXMLInputSource;
    40 import com.sun.xml.internal.stream.StaxXMLInputSource;
    25 import com.sun.xml.internal.stream.XMLEntityStorage;
    41 import com.sun.xml.internal.stream.XMLEntityStorage;
    26 import java.io.*;
    42 import java.io.*;
    27 import java.io.BufferedReader;
       
    28 import java.util.*;
       
    29 
       
    30 import java.io.IOException;
       
    31 import java.io.InputStream;
       
    32 import java.io.InputStreamReader;
       
    33 import java.io.Reader;
       
    34 import java.io.StringReader;
       
    35 import java.lang.reflect.Method;
    43 import java.lang.reflect.Method;
    36 import java.net.HttpURLConnection;
    44 import java.net.HttpURLConnection;
       
    45 import java.net.URISyntaxException;
    37 import java.net.URL;
    46 import java.net.URL;
    38 import java.net.URLConnection;
    47 import java.net.URLConnection;
    39 import java.net.URISyntaxException;
       
    40 import java.util.Hashtable;
    48 import java.util.Hashtable;
    41 import java.util.Iterator;
    49 import java.util.Iterator;
    42 import java.util.Locale;
    50 import java.util.Locale;
    43 import java.util.Map;
    51 import java.util.Map;
    44 import java.util.Stack;
    52 import java.util.Stack;
    45 
    53 import javax.xml.XMLConstants;
    46 
       
    47 import com.sun.org.apache.xerces.internal.impl.io.*;
       
    48 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
       
    49 import com.sun.org.apache.xerces.internal.util.*;
       
    50 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
       
    51 import com.sun.org.apache.xerces.internal.xni.XNIException;
       
    52 import com.sun.org.apache.xerces.internal.xni.parser.*;
       
    53 import com.sun.org.apache.xerces.internal.impl.Constants;
       
    54 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
       
    55 import com.sun.xml.internal.stream.Entity;
       
    56 import com.sun.org.apache.xerces.internal.xni.Augmentations;
       
    57 
       
    58 import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
       
    59 import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
       
    60 import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
       
    61 import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
       
    62 import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
       
    63 import com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler;
       
    64 
       
    65 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
       
    66 import com.sun.org.apache.xerces.internal.util.SecurityManager;
       
    67 import com.sun.org.apache.xerces.internal.util.URI;
       
    68 
    54 
    69 
    55 
    70 /**
    56 /**
    71  * Will keep track of current entity.
    57  * Will keep track of current entity.
    72  *
    58  *
   138 
   124 
   139     /** Feature identifier: warn on duplicate EntityDef */
   125     /** Feature identifier: warn on duplicate EntityDef */
   140     protected static final String WARN_ON_DUPLICATE_ENTITYDEF =
   126     protected static final String WARN_ON_DUPLICATE_ENTITYDEF =
   141             Constants.XERCES_FEATURE_PREFIX +Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE;
   127             Constants.XERCES_FEATURE_PREFIX +Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE;
   142 
   128 
       
   129     /** Feature identifier: load external DTD. */
       
   130     protected static final String LOAD_EXTERNAL_DTD =
       
   131             Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;
       
   132 
   143     // property identifiers
   133     // property identifiers
   144 
   134 
   145     /** Property identifier: symbol table. */
   135     /** Property identifier: symbol table. */
   146     protected static final String SYMBOL_TABLE =
   136     protected static final String SYMBOL_TABLE =
   147             Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
   137             Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
   171 
   161 
   172     /** property identifier: security manager. */
   162     /** property identifier: security manager. */
   173     protected static final String SECURITY_MANAGER =
   163     protected static final String SECURITY_MANAGER =
   174         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
   164         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
   175 
   165 
   176 protected static final String PARSER_SETTINGS =
   166     protected static final String PARSER_SETTINGS =
   177         Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
   167         Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
       
   168 
       
   169     /** property identifier: access external dtd. */
       
   170     protected static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
       
   171 
       
   172     /** access external dtd: file protocol */
       
   173     static final String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
       
   174 
       
   175 
   178     // recognized features and properties
   176     // recognized features and properties
   179 
   177 
   180     /** Recognized features. */
   178     /** Recognized features. */
   181     private static final String[] RECOGNIZED_FEATURES = {
   179     private static final String[] RECOGNIZED_FEATURES = {
   182                 VALIDATION,
   180                 VALIDATION,
   203                 ERROR_REPORTER,
   201                 ERROR_REPORTER,
   204                 ENTITY_RESOLVER,
   202                 ENTITY_RESOLVER,
   205                 VALIDATION_MANAGER,
   203                 VALIDATION_MANAGER,
   206                 BUFFER_SIZE,
   204                 BUFFER_SIZE,
   207                 SECURITY_MANAGER,
   205                 SECURITY_MANAGER,
   208 
   206                 ACCESS_EXTERNAL_DTD
   209     };
   207     };
   210 
   208 
   211     /** Property defaults. */
   209     /** Property defaults. */
   212     private static final Object[] PROPERTY_DEFAULTS = {
   210     private static final Object[] PROPERTY_DEFAULTS = {
   213                 null,
   211                 null,
   214                 null,
   212                 null,
   215                 null,
   213                 null,
   216                 null,
   214                 null,
   217                 new Integer(DEFAULT_BUFFER_SIZE),
   215                 new Integer(DEFAULT_BUFFER_SIZE),
   218                 null
   216                 null,
       
   217                 EXTERNAL_ACCESS_DEFAULT
   219     };
   218     };
   220 
   219 
   221     private static final String XMLEntity = "[xml]".intern();
   220     private static final String XMLEntity = "[xml]".intern();
   222     private static final String DTDEntity = "[dtd]".intern();
   221     private static final String DTDEntity = "[dtd]".intern();
   223 
   222 
   272      * Allow Java encoding names. This feature identifier is:
   271      * Allow Java encoding names. This feature identifier is:
   273      * http://apache.org/xml/features/allow-java-encodings
   272      * http://apache.org/xml/features/allow-java-encodings
   274      */
   273      */
   275     protected boolean fAllowJavaEncodings = true ;
   274     protected boolean fAllowJavaEncodings = true ;
   276 
   275 
       
   276     /** Load external DTD. */
       
   277     protected boolean fLoadExternalDTD = true;
   277 
   278 
   278     // properties
   279     // properties
   279 
   280 
   280     /**
   281     /**
   281      * Symbol table. This property identifier is:
   282      * Symbol table. This property identifier is:
   300     protected StaxEntityResolverWrapper fStaxEntityResolver;
   301     protected StaxEntityResolverWrapper fStaxEntityResolver;
   301 
   302 
   302     /** Property Manager. This is used from Stax */
   303     /** Property Manager. This is used from Stax */
   303     protected PropertyManager fPropertyManager ;
   304     protected PropertyManager fPropertyManager ;
   304 
   305 
   305 
   306     /** used to restrict external access */
       
   307     protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;
   306     // settings
   308     // settings
   307 
   309 
   308     /**
   310     /**
   309      * Validation manager. This property identifier is:
   311      * Validation manager. This property identifier is:
   310      * http://apache.org/xml/properties/internal/validation-manager
   312      * http://apache.org/xml/properties/internal/validation-manager
   363     /** Entity stack. */
   365     /** Entity stack. */
   364     protected Stack fEntityStack = new Stack();
   366     protected Stack fEntityStack = new Stack();
   365 
   367 
   366     /** Current entity. */
   368     /** Current entity. */
   367     protected Entity.ScannedEntity fCurrentEntity = null;
   369     protected Entity.ScannedEntity fCurrentEntity = null;
       
   370 
       
   371     /** identify if the InputSource is created by a resolver */
       
   372     boolean fISCreatedByResolver = false;
   368 
   373 
   369     // shared context
   374     // shared context
   370 
   375 
   371     protected XMLEntityStorage fEntityStorage ;
   376     protected XMLEntityStorage fEntityStorage ;
   372 
   377 
   963         ri.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId);
   968         ri.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId);
   964         if(DEBUG_RESOLVER){
   969         if(DEBUG_RESOLVER){
   965             System.out.println("BEFORE Calling resolveEntity") ;
   970             System.out.println("BEFORE Calling resolveEntity") ;
   966         }
   971         }
   967 
   972 
       
   973         fISCreatedByResolver = false;
   968         //either of Stax or Xerces would be null
   974         //either of Stax or Xerces would be null
   969         if(fStaxEntityResolver != null){
   975         if(fStaxEntityResolver != null){
   970             staxInputSource = fStaxEntityResolver.resolveEntity(ri);
   976             staxInputSource = fStaxEntityResolver.resolveEntity(ri);
       
   977             if(staxInputSource != null) {
       
   978                 fISCreatedByResolver = true;
       
   979             }
   971         }
   980         }
   972 
   981 
   973         if(fEntityResolver != null){
   982         if(fEntityResolver != null){
   974             xmlInputSource = fEntityResolver.resolveEntity(ri);
   983             xmlInputSource = fEntityResolver.resolveEntity(ri);
       
   984             if(xmlInputSource != null) {
       
   985                 fISCreatedByResolver = true;
       
   986             }
   975         }
   987         }
   976 
   988 
   977         if(xmlInputSource != null){
   989         if(xmlInputSource != null){
   978             //wrap this XMLInputSource to StaxInputSource
   990             //wrap this XMLInputSource to StaxInputSource
   979             staxInputSource = new StaxXMLInputSource(xmlInputSource);
   991             staxInputSource = new StaxXMLInputSource(xmlInputSource, fISCreatedByResolver);
   980         }
   992         }
   981 
   993 
   982         // do default resolution
   994         // do default resolution
   983         //this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
   995         //this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
   984         if (staxInputSource == null) {
   996         if (staxInputSource == null) {
  1106             return;
  1118             return;
  1107         }
  1119         }
  1108 
  1120 
  1109         // should we skip external entities?
  1121         // should we skip external entities?
  1110         boolean external = entity.isExternal();
  1122         boolean external = entity.isExternal();
       
  1123         Entity.ExternalEntity externalEntity = null;
       
  1124         String extLitSysId = null, extBaseSysId = null, expandedSystemId = null;
  1111         if (external) {
  1125         if (external) {
       
  1126             externalEntity = (Entity.ExternalEntity)entity;
       
  1127             extLitSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getLiteralSystemId() : null);
       
  1128             extBaseSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getBaseSystemId() : null);
       
  1129             expandedSystemId = expandSystemId(extLitSysId, extBaseSysId);
  1112             boolean unparsed = entity.isUnparsed();
  1130             boolean unparsed = entity.isUnparsed();
  1113             boolean parameter = entityName.startsWith("%");
  1131             boolean parameter = entityName.startsWith("%");
  1114             boolean general = !parameter;
  1132             boolean general = !parameter;
  1115             if (unparsed || (general && !fExternalGeneralEntities) ||
  1133             if (unparsed || (general && !fExternalGeneralEntities) ||
  1116                     (parameter && !fExternalParameterEntities)) {
  1134                     (parameter && !fExternalParameterEntities)) {
  1117 
  1135 
  1118                 if (fEntityHandler != null) {
  1136                 if (fEntityHandler != null) {
  1119                     fResourceIdentifier.clear();
  1137                     fResourceIdentifier.clear();
  1120                     final String encoding = null;
  1138                     final String encoding = null;
  1121                     Entity.ExternalEntity externalEntity = (Entity.ExternalEntity)entity;
       
  1122                     //REVISIT:  since we're storing expandedSystemId in the
       
  1123                     // externalEntity, how could this have got here if it wasn't already
       
  1124                     // expanded??? - neilg
       
  1125                     String extLitSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getLiteralSystemId() : null);
       
  1126                     String extBaseSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getBaseSystemId() : null);
       
  1127                     String expandedSystemId = expandSystemId(extLitSysId, extBaseSysId);
       
  1128                     fResourceIdentifier.setValues(
  1139                     fResourceIdentifier.setValues(
  1129                             (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null),
  1140                             (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null),
  1130                             extLitSysId, extBaseSysId, expandedSystemId);
  1141                             extLitSysId, extBaseSysId, expandedSystemId);
  1131                     fEntityAugs.removeAllItems();
  1142                     fEntityAugs.removeAllItems();
  1132                     fEntityAugs.putItem(Constants.ENTITY_SKIPPED, Boolean.TRUE);
  1143                     fEntityAugs.putItem(Constants.ENTITY_SKIPPED, Boolean.TRUE);
  1160 
  1171 
  1161                         if (fEntityHandler != null) {
  1172                         if (fEntityHandler != null) {
  1162                             fResourceIdentifier.clear();
  1173                             fResourceIdentifier.clear();
  1163                             final String encoding = null;
  1174                             final String encoding = null;
  1164                             if (external) {
  1175                             if (external) {
  1165                                 Entity.ExternalEntity externalEntity = (Entity.ExternalEntity)entity;
       
  1166                                 // REVISIT:  for the same reason above...
       
  1167                                 String extLitSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getLiteralSystemId() : null);
       
  1168                                 String extBaseSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getBaseSystemId() : null);
       
  1169                                 String expandedSystemId = expandSystemId(extLitSysId, extBaseSysId);
       
  1170                                 fResourceIdentifier.setValues(
  1176                                 fResourceIdentifier.setValues(
  1171                                         (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null),
  1177                                         (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null),
  1172                                         extLitSysId, extBaseSysId, expandedSystemId);
  1178                                         extLitSysId, extBaseSysId, expandedSystemId);
  1173                             }
  1179                             }
  1174                             fEntityAugs.removeAllItems();
  1180                             fEntityAugs.removeAllItems();
  1186         // resolve external entity
  1192         // resolve external entity
  1187         StaxXMLInputSource staxInputSource = null;
  1193         StaxXMLInputSource staxInputSource = null;
  1188         XMLInputSource xmlInputSource = null ;
  1194         XMLInputSource xmlInputSource = null ;
  1189 
  1195 
  1190         if (external) {
  1196         if (external) {
  1191             Entity.ExternalEntity externalEntity = (Entity.ExternalEntity)entity;
       
  1192             staxInputSource = resolveEntityAsPerStax(externalEntity.entityLocation);
  1197             staxInputSource = resolveEntityAsPerStax(externalEntity.entityLocation);
  1193             /** xxx:  Waiting from the EG
  1198             /** xxx:  Waiting from the EG
  1194              * //simply return if there was entity resolver registered and application
  1199              * //simply return if there was entity resolver registered and application
  1195              * //returns either XMLStreamReader or XMLEventReader.
  1200              * //returns either XMLStreamReader or XMLEventReader.
  1196              * if(staxInputSource.hasXMLStreamOrXMLEventReader()) return ;
  1201              * if(staxInputSource.hasXMLStreamOrXMLEventReader()) return ;
  1197              */
  1202              */
  1198             xmlInputSource = staxInputSource.getXMLInputSource() ;
  1203             xmlInputSource = staxInputSource.getXMLInputSource() ;
       
  1204             if (!fISCreatedByResolver) {
       
  1205                 //let the not-LoadExternalDTD or not-SupportDTD process to handle the situation
       
  1206                 if (fLoadExternalDTD) {
       
  1207                     String accessError = SecuritySupport.checkAccess(expandedSystemId, fAccessExternalDTD, Constants.ACCESS_EXTERNAL_ALL);
       
  1208                     if (accessError != null) {
       
  1209                         fErrorReporter.reportError(this.getEntityScanner(),XMLMessageFormatter.XML_DOMAIN,
       
  1210                                 "AccessExternalEntity",
       
  1211                                 new Object[] { SecuritySupport.sanitizePath(expandedSystemId), accessError },
       
  1212                                 XMLErrorReporter.SEVERITY_FATAL_ERROR);
       
  1213                     }
       
  1214                 }
       
  1215             }
  1199         }
  1216         }
  1200         // wrap internal entity
  1217         // wrap internal entity
  1201         else {
  1218         else {
  1202             Entity.InternalEntity internalEntity = (Entity.InternalEntity)entity;
  1219             Entity.InternalEntity internalEntity = (Entity.InternalEntity)entity;
  1203             Reader reader = new StringReader(internalEntity.text);
  1220             Reader reader = new StringReader(internalEntity.text);
  1398             fStaxEntityResolver = (StaxEntityResolverWrapper)propertyManager.getProperty(STAX_ENTITY_RESOLVER);
  1415             fStaxEntityResolver = (StaxEntityResolverWrapper)propertyManager.getProperty(STAX_ENTITY_RESOLVER);
  1399         } catch (XMLConfigurationException e) {
  1416         } catch (XMLConfigurationException e) {
  1400             fStaxEntityResolver = null;
  1417             fStaxEntityResolver = null;
  1401         }
  1418         }
  1402 
  1419 
       
  1420         // Zephyr feature ignore-external-dtd is the opposite of Xerces' load-external-dtd
       
  1421         fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD)).booleanValue();
       
  1422 
       
  1423         // JAXP 1.5 feature
       
  1424         fAccessExternalDTD = (String) propertyManager.getProperty(ACCESS_EXTERNAL_DTD);
       
  1425 
  1403         // initialize state
  1426         // initialize state
  1404         //fStandalone = false;
  1427         //fStandalone = false;
  1405         fEntities.clear();
  1428         fEntities.clear();
  1406         fEntityStack.removeAllElements();
  1429         fEntityStack.removeAllElements();
  1407         fCurrentEntity = null;
  1430         fCurrentEntity = null;
  1408         fValidation = false;
  1431         fValidation = false;
  1409         fExternalGeneralEntities = true;
  1432         fExternalGeneralEntities = true;
  1410         fExternalParameterEntities = true;
  1433         fExternalParameterEntities = true;
  1411         fAllowJavaEncodings = true ;
  1434         fAllowJavaEncodings = true ;
  1412 
       
  1413         //test();
       
  1414     }
  1435     }
  1415 
  1436 
  1416     /**
  1437     /**
  1417      * Resets the component. The component can query the component manager
  1438      * Resets the component. The component can query the component manager
  1418      * about any features and properties that affect the operation of the
  1439      * about any features and properties that affect the operation of the
  1451 
  1472 
  1452         // xerces features
  1473         // xerces features
  1453         fAllowJavaEncodings = componentManager.getFeature(ALLOW_JAVA_ENCODINGS, false);
  1474         fAllowJavaEncodings = componentManager.getFeature(ALLOW_JAVA_ENCODINGS, false);
  1454         fWarnDuplicateEntityDef = componentManager.getFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);
  1475         fWarnDuplicateEntityDef = componentManager.getFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);
  1455         fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
  1476         fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
       
  1477         fLoadExternalDTD = componentManager.getFeature(LOAD_EXTERNAL_DTD, true);
  1456 
  1478 
  1457         // xerces properties
  1479         // xerces properties
  1458         fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
  1480         fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
  1459         fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
  1481         fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
  1460         fEntityResolver = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER, null);
  1482         fEntityResolver = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER, null);
  1461         fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null);
  1483         fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null);
  1462         fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null);
  1484         fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null);
  1463         fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
  1485         fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
       
  1486 
       
  1487         // JAXP 1.5 feature
       
  1488         fAccessExternalDTD = (String) componentManager.getProperty(ACCESS_EXTERNAL_DTD, EXTERNAL_ACCESS_DEFAULT);
  1464 
  1489 
  1465         //reset general state
  1490         //reset general state
  1466         reset();
  1491         reset();
  1467 
  1492 
  1468         fEntityScanner.reset(componentManager);
  1493         fEntityScanner.reset(componentManager);
  1552             final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
  1577             final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
  1553             if (suffixLength == Constants.ALLOW_JAVA_ENCODINGS_FEATURE.length() &&
  1578             if (suffixLength == Constants.ALLOW_JAVA_ENCODINGS_FEATURE.length() &&
  1554                 featureId.endsWith(Constants.ALLOW_JAVA_ENCODINGS_FEATURE)) {
  1579                 featureId.endsWith(Constants.ALLOW_JAVA_ENCODINGS_FEATURE)) {
  1555                 fAllowJavaEncodings = state;
  1580                 fAllowJavaEncodings = state;
  1556             }
  1581             }
       
  1582             if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() &&
       
  1583                 featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
       
  1584                 fLoadExternalDTD = state;
       
  1585                 return;
       
  1586             }
  1557         }
  1587         }
  1558 
  1588 
  1559     } // setFeature(String,boolean)
  1589     } // setFeature(String,boolean)
  1560 
  1590 
  1561     /**
  1591     /**
  1608                 fSecurityManager = (SecurityManager)value;
  1638                 fSecurityManager = (SecurityManager)value;
  1609                 fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
  1639                 fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
  1610             }
  1640             }
  1611         }
  1641         }
  1612 
  1642 
       
  1643         //JAXP 1.5 properties
       
  1644         if (propertyId.startsWith(Constants.JAXPAPI_PROPERTY_PREFIX)) {
       
  1645             if (propertyId.equals(ACCESS_EXTERNAL_DTD))
       
  1646             {
       
  1647                 fAccessExternalDTD = (String)value;
       
  1648             }
       
  1649         }
  1613     }
  1650     }
       
  1651 
  1614     /**
  1652     /**
  1615      * Returns a list of property identifiers that are recognized by
  1653      * Returns a list of property identifiers that are recognized by
  1616      * this component. This method may return null if no properties
  1654      * this component. This method may return null if no properties
  1617      * are recognized by this component.
  1655      * are recognized by this component.
  1618      */
  1656      */