mrglavas 2004/07/18 19:22:50 Modified: java/src/org/apache/xerces/xinclude XIncludeHandler.java Log: Fixing Jira Bug #843:
http://nagoya.apache.org/jira/browse/XERCESJ-843 To ensure that only the aggregate document is schema validated, the XInclude handler sets the schema feature to false to keep the child pipeline it creates from containing a schema validator. This will activate the DTD validator on the child pipeline if the validation feature was set to true, causing the include to be validate against a (probably non-existent) DTD. This should now be fixed. In addition to turning the schema validation feature off, turn off other related validation features. Revision Changes Path 1.28 +26 -8 xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java Index: XIncludeHandler.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- XIncludeHandler.java 18 Jul 2004 19:57:42 -0000 1.27 +++ XIncludeHandler.java 19 Jul 2004 02:22:50 -0000 1.28 @@ -159,6 +159,18 @@ private final static int STATE_EXPECT_FALLBACK = 3; // recognized features and properties + + /** Feature identifier: validation. */ + protected static final String VALIDATION = + Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE; + + /** Feature identifier: schema validation. */ + protected static final String SCHEMA_VALIDATION = + Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE; + + /** Feature identifier: dynamic validation. */ + protected static final String DYNAMIC_VALIDATION = + Constants.XERCES_FEATURE_PREFIX + Constants.DYNAMIC_VALIDATION_FEATURE; /** Feature identifier: allow notation and unparsed entity events to be sent out of order. */ protected static final String ALLOW_UE_AND_NOTATION_EVENTS = @@ -415,6 +427,19 @@ fSettings = new ParserConfigurationSettings(); copyFeatures(componentManager, fSettings); + + // we don't want a schema validator on the new pipeline, + // so if it was enabled, we set the feature to false as + // well as other validation features. + try { + if (componentManager.getFeature(SCHEMA_VALIDATION)) { + fSettings.setFeature(SCHEMA_VALIDATION, false); + fSettings.setFeature(DYNAMIC_VALIDATION, false); + fSettings.setFeature(VALIDATION, false); + } + } + catch (XMLConfigurationException e) {} + // Don't reset fChildConfig -- we don't want it to share the same components. // It will be reset when it is actually used to parse something. } // reset(XMLComponentManager) @@ -1260,13 +1285,6 @@ // set all features on parserConfig to match this parser configuration copyFeatures(fSettings, fChildConfig); - - // we don't want a schema validator on the new pipeline, - // so we set it to false, regardless of what was copied above - fChildConfig.setFeature( - Constants.XERCES_FEATURE_PREFIX - + Constants.SCHEMA_VALIDATION_FEATURE, - false); try { // REVISIT: If we're going to support content negotation for --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]