mrglavas 2005/01/11 06:35:17
Modified: java/src/org/apache/xerces/xinclude XIncludeHandler.java
Log:
Performance: Only copy features to child configuration when they've changed.
This not only saves copying but allows the child config to avoid reading its
parser configuration on reset.
Revision Changes Path
1.42 +16 -3
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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- XIncludeHandler.java 11 Jan 2005 13:40:28 -0000 1.41
+++ XIncludeHandler.java 11 Jan 2005 14:35:16 -0000 1.42
@@ -318,6 +318,9 @@
// track whether the root element of the result infoset has been
processed
private boolean fSeenRootElement;
+
+ // track whether the child config needs its features refreshed
+ private boolean fNeedCopyFeatures = true;
// Constructors
@@ -385,6 +388,9 @@
}
}
catch (XMLConfigurationException e) {}
+
+ // parser settings changed. Need to refresh features on child config.
+ fNeedCopyFeatures = true;
try {
fSendUEAndNotationEvents =
@@ -540,6 +546,7 @@
fSendUEAndNotationEvents = state;
}
if (fSettings != null) {
+ fNeedCopyFeatures = true;
fSettings.setFeature(featureId, state);
}
} // setFeature(String,boolean)
@@ -1469,8 +1476,11 @@
if (fSymbolTable != null)
fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable);
if (fErrorReporter != null)
fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
if (fEntityResolver != null)
fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver);
- if (fSecurityManager != null)
fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);
+ fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);
fChildConfig.setProperty(BUFFER_SIZE, new
Integer(fBufferSize));
+
+ // features must be copied to child configuration
+ fNeedCopyFeatures = true;
// use the same namespace context
fChildConfig.setProperty(
@@ -1487,7 +1497,10 @@
}
// set all features on parserConfig to match this parser
configuration
- copyFeatures(fSettings, fChildConfig);
+ if (fNeedCopyFeatures) {
+ copyFeatures(fSettings, fChildConfig);
+ }
+ fNeedCopyFeatures = false;
try {
fNamespaceContext.pushScope();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]