src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java

Print this page




   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 package com.sun.org.apache.xerces.internal.xinclude;
  21 
  22 import java.io.CharConversionException;
  23 import java.io.IOException;
  24 import java.util.ArrayList;
  25 import java.util.Enumeration;
  26 import java.util.Locale;
  27 import java.util.Stack;
  28 import java.util.StringTokenizer;

  29 
  30 import com.sun.org.apache.xerces.internal.impl.Constants;
  31 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
  32 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
  33 import com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException;
  34 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
  35 import com.sun.org.apache.xerces.internal.util.AugmentationsImpl;
  36 import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
  37 import com.sun.org.apache.xerces.internal.util.IntStack;
  38 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
  39 import com.sun.org.apache.xerces.internal.util.SecurityManager;
  40 import com.sun.org.apache.xerces.internal.util.SymbolTable;
  41 import com.sun.org.apache.xerces.internal.util.URI;
  42 import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
  43 import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
  44 import com.sun.org.apache.xerces.internal.util.XMLChar;
  45 import com.sun.org.apache.xerces.internal.util.XMLSymbols;
  46 import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
  47 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  48 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;


 212 
 213     /** Property identifier: error reporter. */
 214     protected static final String ERROR_REPORTER =
 215         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
 216 
 217     /** Property identifier: entity resolver. */
 218     protected static final String ENTITY_RESOLVER =
 219         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
 220 
 221     /** property identifier: security manager. */
 222     protected static final String SECURITY_MANAGER =
 223         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
 224 
 225     /** property identifier: buffer size. */
 226     public static final String BUFFER_SIZE =
 227         Constants.XERCES_PROPERTY_PREFIX + Constants.BUFFER_SIZE_PROPERTY;
 228 
 229     protected static final String PARSER_SETTINGS =
 230         Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
 231 








 232     /** Recognized features. */
 233     private static final String[] RECOGNIZED_FEATURES =
 234         { ALLOW_UE_AND_NOTATION_EVENTS, XINCLUDE_FIXUP_BASE_URIS, XINCLUDE_FIXUP_LANGUAGE };
 235 
 236     /** Feature defaults. */
 237     private static final Boolean[] FEATURE_DEFAULTS = { Boolean.TRUE, Boolean.TRUE, Boolean.TRUE };
 238 
 239     /** Recognized properties. */
 240     private static final String[] RECOGNIZED_PROPERTIES =
 241         { ERROR_REPORTER, ENTITY_RESOLVER, SECURITY_MANAGER, BUFFER_SIZE };
 242 
 243     /** Property defaults. */
 244     private static final Object[] PROPERTY_DEFAULTS = { null, null, null, new Integer(XMLEntityManager.DEFAULT_BUFFER_SIZE) };
 245 
 246     // instance variables
 247 
 248     // for XMLDocumentFilter
 249     protected XMLDocumentHandler fDocumentHandler;
 250     protected XMLDocumentSource fDocumentSource;
 251 


 266 
 267     // we cache the child parser configuration, so we don't have to re-create
 268     // the objects when the parser is re-used
 269     protected XMLParserConfiguration fChildConfig;
 270 
 271     // The cached child parser configuration, may contain a
 272     // XInclude or XPointer Handler.  Cache both these
 273     protected XMLParserConfiguration fXIncludeChildConfig;
 274     protected XMLParserConfiguration fXPointerChildConfig;
 275 
 276     // The XPointerProcessor
 277     protected XPointerProcessor fXPtrProcessor = null;
 278 
 279     protected XMLLocator fDocLocation;
 280     protected XIncludeMessageFormatter fXIncludeMessageFormatter = new XIncludeMessageFormatter();
 281     protected XIncludeNamespaceSupport fNamespaceContext;
 282     protected SymbolTable fSymbolTable;
 283     protected XMLErrorReporter fErrorReporter;
 284     protected XMLEntityResolver fEntityResolver;
 285     protected SecurityManager fSecurityManager;





 286 

 287     // these are needed for text include processing
 288     protected XIncludeTextReader fXInclude10TextReader;
 289     protected XIncludeTextReader fXInclude11TextReader;
 290 
 291     // these are needed for XML Base processing
 292     protected XMLResourceIdentifier fCurrentBaseURI;
 293     protected IntStack fBaseURIScope;
 294     protected Stack fBaseURI;
 295     protected Stack fLiteralSystemID;
 296     protected Stack fExpandedSystemID;
 297 
 298     // these are needed for Language Fixup
 299     protected IntStack fLanguageScope;
 300     protected Stack fLanguageStack;
 301     protected String fCurrentLanguage;
 302 
 303     // used for passing features on to child XIncludeHandler objects
 304     protected ParserConfigurationSettings fSettings;
 305 
 306     // The current element depth.  We start at depth 0 (before we've reached any elements).


 506             fEntityResolver = null;
 507         }
 508 
 509         // Get security manager.
 510         try {
 511             SecurityManager value =
 512                 (SecurityManager)componentManager.getProperty(
 513                     SECURITY_MANAGER);
 514 
 515             if (value != null) {
 516                 fSecurityManager = value;
 517                 if (fChildConfig != null) {
 518                     fChildConfig.setProperty(SECURITY_MANAGER, value);
 519                 }
 520             }
 521         }
 522         catch (XMLConfigurationException e) {
 523             fSecurityManager = null;
 524         }
 525 


 526         // Get buffer size.
 527         try {
 528             Integer value =
 529                 (Integer)componentManager.getProperty(
 530                     BUFFER_SIZE);
 531 
 532             if (value != null && value.intValue() > 0) {
 533                 fBufferSize = value.intValue();
 534                 if (fChildConfig != null) {
 535                     fChildConfig.setProperty(BUFFER_SIZE, value);
 536                 }
 537             }
 538             else {
 539                 fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE)).intValue();
 540             }
 541         }
 542         catch (XMLConfigurationException e) {
 543                 fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE)).intValue();
 544         }
 545 


 647             setErrorReporter((XMLErrorReporter)value);
 648             if (fChildConfig != null) {
 649                 fChildConfig.setProperty(propertyId, value);
 650             }
 651             return;
 652         }
 653         if (propertyId.equals(ENTITY_RESOLVER)) {
 654             fEntityResolver = (XMLEntityResolver)value;
 655             if (fChildConfig != null) {
 656                 fChildConfig.setProperty(propertyId, value);
 657             }
 658             return;
 659         }
 660         if (propertyId.equals(SECURITY_MANAGER)) {
 661             fSecurityManager = (SecurityManager)value;
 662             if (fChildConfig != null) {
 663                 fChildConfig.setProperty(propertyId, value);
 664             }
 665             return;
 666         }








 667         if (propertyId.equals(BUFFER_SIZE)) {
 668             Integer bufferSize = (Integer) value;
 669             if (fChildConfig != null) {
 670                 fChildConfig.setProperty(propertyId, value);
 671             }
 672             if (bufferSize != null && bufferSize.intValue() > 0) {
 673                 fBufferSize = bufferSize.intValue();
 674                 // Reset XML 1.0 text reader.
 675                 if (fXInclude10TextReader != null) {
 676                     fXInclude10TextReader.setBufferSize(fBufferSize);
 677                 }
 678                 // Reset XML 1.1 text reader.
 679                 if (fXInclude11TextReader != null) {
 680                     fXInclude11TextReader.setBufferSize(fBufferSize);
 681                 }
 682             }
 683             return;
 684         }
 685 
 686     } // setProperty(String,Object)


1561 
1562         if (parse.equals(XINCLUDE_PARSE_XML)) {
1563             // Instead of always creating a new configuration, the first one can be reused
1564             if ((xpointer != null && fXPointerChildConfig == null)
1565                         || (xpointer == null && fXIncludeChildConfig == null) ) {
1566 
1567                 String parserName = XINCLUDE_DEFAULT_CONFIGURATION;
1568                 if (xpointer != null)
1569                         parserName = "com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration";
1570 
1571                 fChildConfig =
1572                     (XMLParserConfiguration)ObjectFactory.newInstance(
1573                         parserName,
1574                         true);
1575 
1576                 // use the same symbol table, error reporter, entity resolver, security manager and buffer size.
1577                 if (fSymbolTable != null) fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable);
1578                 if (fErrorReporter != null) fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
1579                 if (fEntityResolver != null) fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver);
1580                 fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);

1581                 fChildConfig.setProperty(BUFFER_SIZE, new Integer(fBufferSize));
1582 
1583                 // features must be copied to child configuration
1584                 fNeedCopyFeatures = true;
1585 
1586                 // use the same namespace context
1587                 fChildConfig.setProperty(
1588                     Constants.XERCES_PROPERTY_PREFIX
1589                         + Constants.NAMESPACE_CONTEXT_PROPERTY,
1590                     fNamespaceContext);
1591 
1592                 fChildConfig.setFeature(
1593                             XINCLUDE_FIXUP_BASE_URIS,
1594                             fFixupBaseURIs);
1595 
1596                 fChildConfig.setFeature(
1597                             XINCLUDE_FIXUP_LANGUAGE,
1598                             fFixupLanguage);
1599 
1600 


1674                     fErrorReporter.setDocumentLocator(fDocLocation);
1675                 }
1676 
1677                 // If the xpointer attribute is present
1678                 if (xpointer != null ) {
1679                         // and it was not resolved
1680                         if (!((XPointerProcessor)fXPtrProcessor).isXPointerResolved()) {
1681                         Locale locale = (fErrorReporter != null) ? fErrorReporter.getLocale() : null;
1682                         String reason = fXIncludeMessageFormatter.formatMessage(locale, "XPointerResolutionUnsuccessful", null);
1683                         reportResourceError("XMLResourceError", new Object[] {href, reason});
1684                                 // use the fallback
1685                                 return false;
1686                         }
1687                 }
1688             }
1689             catch (XNIException e) {
1690                 // necessary to make sure proper location is reported in errors
1691                 if (fErrorReporter != null) {
1692                     fErrorReporter.setDocumentLocator(fDocLocation);
1693                 }
1694                 reportFatalError("XMLParseError", new Object[] { href });
1695             }
1696             catch (IOException e) {
1697                 // necessary to make sure proper location is reported in errors
1698                 if (fErrorReporter != null) {
1699                     fErrorReporter.setDocumentLocator(fDocLocation);
1700                 }
1701                 // An IOException indicates that we had trouble reading the file, not
1702                 // that it was an invalid XML file.  So we send a resource error, not a
1703                 // fatal error.
1704                 reportResourceError(
1705                     "XMLResourceError",
1706                     new Object[] { href, e.getMessage()});
1707                 return false;
1708             }
1709             finally {
1710                 fNamespaceContext.popScope();
1711             }
1712         }
1713         else if (parse.equals(XINCLUDE_PARSE_TEXT)) {
1714             // we only care about encoding for parse="text"




   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 package com.sun.org.apache.xerces.internal.xinclude;
  21 
  22 import java.io.CharConversionException;
  23 import java.io.IOException;
  24 import java.util.ArrayList;
  25 import java.util.Enumeration;
  26 import java.util.Locale;
  27 import java.util.Stack;
  28 import java.util.StringTokenizer;
  29 import javax.xml.XMLConstants;
  30 
  31 import com.sun.org.apache.xerces.internal.impl.Constants;
  32 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
  33 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
  34 import com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException;
  35 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
  36 import com.sun.org.apache.xerces.internal.util.AugmentationsImpl;
  37 import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
  38 import com.sun.org.apache.xerces.internal.util.IntStack;
  39 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
  40 import com.sun.org.apache.xerces.internal.util.SecurityManager;
  41 import com.sun.org.apache.xerces.internal.util.SymbolTable;
  42 import com.sun.org.apache.xerces.internal.util.URI;
  43 import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
  44 import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
  45 import com.sun.org.apache.xerces.internal.util.XMLChar;
  46 import com.sun.org.apache.xerces.internal.util.XMLSymbols;
  47 import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
  48 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  49 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;


 213 
 214     /** Property identifier: error reporter. */
 215     protected static final String ERROR_REPORTER =
 216         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
 217 
 218     /** Property identifier: entity resolver. */
 219     protected static final String ENTITY_RESOLVER =
 220         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
 221 
 222     /** property identifier: security manager. */
 223     protected static final String SECURITY_MANAGER =
 224         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
 225 
 226     /** property identifier: buffer size. */
 227     public static final String BUFFER_SIZE =
 228         Constants.XERCES_PROPERTY_PREFIX + Constants.BUFFER_SIZE_PROPERTY;
 229 
 230     protected static final String PARSER_SETTINGS =
 231         Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
 232 
 233     /** property identifier: access external dtd. */
 234     protected static final String ACCESS_EXTERNAL_DTD = XMLConstants.ACCESS_EXTERNAL_DTD;
 235 
 236     /** access external dtd: file protocol 
 237      *  For DOM/SAX, the secure feature is set to true by default
 238      */
 239     final static String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
 240 
 241     /** Recognized features. */
 242     private static final String[] RECOGNIZED_FEATURES =
 243         { ALLOW_UE_AND_NOTATION_EVENTS, XINCLUDE_FIXUP_BASE_URIS, XINCLUDE_FIXUP_LANGUAGE };
 244 
 245     /** Feature defaults. */
 246     private static final Boolean[] FEATURE_DEFAULTS = { Boolean.TRUE, Boolean.TRUE, Boolean.TRUE };
 247 
 248     /** Recognized properties. */
 249     private static final String[] RECOGNIZED_PROPERTIES =
 250         { ERROR_REPORTER, ENTITY_RESOLVER, SECURITY_MANAGER, BUFFER_SIZE };
 251 
 252     /** Property defaults. */
 253     private static final Object[] PROPERTY_DEFAULTS = { null, null, null, new Integer(XMLEntityManager.DEFAULT_BUFFER_SIZE) };
 254 
 255     // instance variables
 256 
 257     // for XMLDocumentFilter
 258     protected XMLDocumentHandler fDocumentHandler;
 259     protected XMLDocumentSource fDocumentSource;
 260 


 275 
 276     // we cache the child parser configuration, so we don't have to re-create
 277     // the objects when the parser is re-used
 278     protected XMLParserConfiguration fChildConfig;
 279 
 280     // The cached child parser configuration, may contain a
 281     // XInclude or XPointer Handler.  Cache both these
 282     protected XMLParserConfiguration fXIncludeChildConfig;
 283     protected XMLParserConfiguration fXPointerChildConfig;
 284 
 285     // The XPointerProcessor
 286     protected XPointerProcessor fXPtrProcessor = null;
 287 
 288     protected XMLLocator fDocLocation;
 289     protected XIncludeMessageFormatter fXIncludeMessageFormatter = new XIncludeMessageFormatter();
 290     protected XIncludeNamespaceSupport fNamespaceContext;
 291     protected SymbolTable fSymbolTable;
 292     protected XMLErrorReporter fErrorReporter;
 293     protected XMLEntityResolver fEntityResolver;
 294     protected SecurityManager fSecurityManager;
 295     /**
 296      * comma-delimited list of protocols that are allowed for the purpose
 297      * of accessing external dtd or entity references
 298      */
 299     protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;
 300 
 301 
 302     // these are needed for text include processing
 303     protected XIncludeTextReader fXInclude10TextReader;
 304     protected XIncludeTextReader fXInclude11TextReader;
 305 
 306     // these are needed for XML Base processing
 307     protected XMLResourceIdentifier fCurrentBaseURI;
 308     protected IntStack fBaseURIScope;
 309     protected Stack fBaseURI;
 310     protected Stack fLiteralSystemID;
 311     protected Stack fExpandedSystemID;
 312 
 313     // these are needed for Language Fixup
 314     protected IntStack fLanguageScope;
 315     protected Stack fLanguageStack;
 316     protected String fCurrentLanguage;
 317 
 318     // used for passing features on to child XIncludeHandler objects
 319     protected ParserConfigurationSettings fSettings;
 320 
 321     // The current element depth.  We start at depth 0 (before we've reached any elements).


 521             fEntityResolver = null;
 522         }
 523 
 524         // Get security manager.
 525         try {
 526             SecurityManager value =
 527                 (SecurityManager)componentManager.getProperty(
 528                     SECURITY_MANAGER);
 529 
 530             if (value != null) {
 531                 fSecurityManager = value;
 532                 if (fChildConfig != null) {
 533                     fChildConfig.setProperty(SECURITY_MANAGER, value);
 534                 }
 535             }
 536         }
 537         catch (XMLConfigurationException e) {
 538             fSecurityManager = null;
 539         }
 540 
 541         fAccessExternalDTD = (String)componentManager.getProperty(ACCESS_EXTERNAL_DTD);
 542 
 543         // Get buffer size.
 544         try {
 545             Integer value =
 546                 (Integer)componentManager.getProperty(
 547                     BUFFER_SIZE);
 548 
 549             if (value != null && value.intValue() > 0) {
 550                 fBufferSize = value.intValue();
 551                 if (fChildConfig != null) {
 552                     fChildConfig.setProperty(BUFFER_SIZE, value);
 553                 }
 554             }
 555             else {
 556                 fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE)).intValue();
 557             }
 558         }
 559         catch (XMLConfigurationException e) {
 560                 fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE)).intValue();
 561         }
 562 


 664             setErrorReporter((XMLErrorReporter)value);
 665             if (fChildConfig != null) {
 666                 fChildConfig.setProperty(propertyId, value);
 667             }
 668             return;
 669         }
 670         if (propertyId.equals(ENTITY_RESOLVER)) {
 671             fEntityResolver = (XMLEntityResolver)value;
 672             if (fChildConfig != null) {
 673                 fChildConfig.setProperty(propertyId, value);
 674             }
 675             return;
 676         }
 677         if (propertyId.equals(SECURITY_MANAGER)) {
 678             fSecurityManager = (SecurityManager)value;
 679             if (fChildConfig != null) {
 680                 fChildConfig.setProperty(propertyId, value);
 681             }
 682             return;
 683         }
 684         if (propertyId.equals(ACCESS_EXTERNAL_DTD)) {
 685             fAccessExternalDTD = (String)value;
 686             if (fChildConfig != null) {
 687                 fChildConfig.setProperty(propertyId, value);
 688             }
 689             return;
 690         }
 691 
 692         if (propertyId.equals(BUFFER_SIZE)) {
 693             Integer bufferSize = (Integer) value;
 694             if (fChildConfig != null) {
 695                 fChildConfig.setProperty(propertyId, value);
 696             }
 697             if (bufferSize != null && bufferSize.intValue() > 0) {
 698                 fBufferSize = bufferSize.intValue();
 699                 // Reset XML 1.0 text reader.
 700                 if (fXInclude10TextReader != null) {
 701                     fXInclude10TextReader.setBufferSize(fBufferSize);
 702                 }
 703                 // Reset XML 1.1 text reader.
 704                 if (fXInclude11TextReader != null) {
 705                     fXInclude11TextReader.setBufferSize(fBufferSize);
 706                 }
 707             }
 708             return;
 709         }
 710 
 711     } // setProperty(String,Object)


1586 
1587         if (parse.equals(XINCLUDE_PARSE_XML)) {
1588             // Instead of always creating a new configuration, the first one can be reused
1589             if ((xpointer != null && fXPointerChildConfig == null)
1590                         || (xpointer == null && fXIncludeChildConfig == null) ) {
1591 
1592                 String parserName = XINCLUDE_DEFAULT_CONFIGURATION;
1593                 if (xpointer != null)
1594                         parserName = "com.sun.org.apache.xerces.internal.parsers.XPointerParserConfiguration";
1595 
1596                 fChildConfig =
1597                     (XMLParserConfiguration)ObjectFactory.newInstance(
1598                         parserName,
1599                         true);
1600 
1601                 // use the same symbol table, error reporter, entity resolver, security manager and buffer size.
1602                 if (fSymbolTable != null) fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable);
1603                 if (fErrorReporter != null) fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
1604                 if (fEntityResolver != null) fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver);
1605                 fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);
1606                 fChildConfig.setProperty(ACCESS_EXTERNAL_DTD, fAccessExternalDTD);
1607                 fChildConfig.setProperty(BUFFER_SIZE, new Integer(fBufferSize));
1608 
1609                 // features must be copied to child configuration
1610                 fNeedCopyFeatures = true;
1611 
1612                 // use the same namespace context
1613                 fChildConfig.setProperty(
1614                     Constants.XERCES_PROPERTY_PREFIX
1615                         + Constants.NAMESPACE_CONTEXT_PROPERTY,
1616                     fNamespaceContext);
1617 
1618                 fChildConfig.setFeature(
1619                             XINCLUDE_FIXUP_BASE_URIS,
1620                             fFixupBaseURIs);
1621 
1622                 fChildConfig.setFeature(
1623                             XINCLUDE_FIXUP_LANGUAGE,
1624                             fFixupLanguage);
1625 
1626 


1700                     fErrorReporter.setDocumentLocator(fDocLocation);
1701                 }
1702 
1703                 // If the xpointer attribute is present
1704                 if (xpointer != null ) {
1705                         // and it was not resolved
1706                         if (!((XPointerProcessor)fXPtrProcessor).isXPointerResolved()) {
1707                         Locale locale = (fErrorReporter != null) ? fErrorReporter.getLocale() : null;
1708                         String reason = fXIncludeMessageFormatter.formatMessage(locale, "XPointerResolutionUnsuccessful", null);
1709                         reportResourceError("XMLResourceError", new Object[] {href, reason});
1710                                 // use the fallback
1711                                 return false;
1712                         }
1713                 }
1714             }
1715             catch (XNIException e) {
1716                 // necessary to make sure proper location is reported in errors
1717                 if (fErrorReporter != null) {
1718                     fErrorReporter.setDocumentLocator(fDocLocation);
1719                 }
1720                 reportFatalError("XMLParseError", new Object[] { href, e.getMessage() });
1721             }
1722             catch (IOException e) {
1723                 // necessary to make sure proper location is reported in errors
1724                 if (fErrorReporter != null) {
1725                     fErrorReporter.setDocumentLocator(fDocLocation);
1726                 }
1727                 // An IOException indicates that we had trouble reading the file, not
1728                 // that it was an invalid XML file.  So we send a resource error, not a
1729                 // fatal error.
1730                 reportResourceError(
1731                     "XMLResourceError",
1732                     new Object[] { href, e.getMessage()});
1733                 return false;
1734             }
1735             finally {
1736                 fNamespaceContext.popScope();
1737             }
1738         }
1739         else if (parse.equals(XINCLUDE_PARSE_TEXT)) {
1740             // we only care about encoding for parse="text"