You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2004/01/24 00:43:40 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom DOMConfigurationImpl.java
mrglavas 2004/01/23 15:43:40
Modified: java/src/org/apache/xerces/parsers AbstractSAXParser.java
StandardParserConfiguration.java
XML11Configuration.java
NonValidatingConfiguration.java
BasicParserConfiguration.java DTDConfiguration.java
java/src/org/apache/xerces/impl/xs/opti
SchemaParsingConfig.java
java/src/org/apache/xerces/impl/xs/models CMNodeFactory.java
java/src/org/apache/xerces/impl XMLNamespaceBinder.java
XMLDocumentScannerImpl.java XMLEntityManager.java
XMLDocumentFragmentScannerImpl.java
XMLErrorReporter.java XMLScanner.java
java/src/org/apache/xerces/dom DOMConfigurationImpl.java
Log:
Reducing creation of short lived objects. Many of the
check/get/set-feature/property methods call String.substring
creating objects are only used a few times to compare against
other strings.
Instead of creating substrings we call regionMatches
instead to match the feature/property suffixes.
Revision Changes Path
1.45 +30 -20 xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java
Index: AbstractSAXParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- AbstractSAXParser.java 18 Nov 2003 23:08:03 -0000 1.44
+++ AbstractSAXParser.java 23 Jan 2004 23:43:39 -0000 1.45
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001-2003 The Apache Software Foundation.
+ * Copyright (c) 2001-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1442,10 +1442,11 @@
//
if (featureId.startsWith(Constants.SAX_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.SAX_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.SAX_FEATURE_PREFIX.length();
// http://xml.org/sax/features/namespaces
- if (feature.equals(Constants.NAMESPACES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.NAMESPACES_FEATURE,
+ 0, Constants.NAMESPACES_FEATURE.length())) {
fConfiguration.setFeature(featureId, state);
fNamespaces = state;
return;
@@ -1456,7 +1457,8 @@
// (the default), raw prefixed names may optionally be reported,
// and xmlns* attributes must not be reported.
//
- if (feature.equals(Constants.NAMESPACE_PREFIXES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.NAMESPACE_PREFIXES_FEATURE,
+ 0, Constants.NAMESPACE_PREFIXES_FEATURE.length())) {
fConfiguration.setFeature(featureId, state);
fNamespacePrefixes = state;
return;
@@ -1465,7 +1467,8 @@
// controls the use of java.lang.String#intern() for strings
// passed to SAX handlers.
//
- if (feature.equals(Constants.STRING_INTERNING_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.STRING_INTERNING_FEATURE,
+ 0, Constants.STRING_INTERNING_FEATURE.length())) {
if (!state) {
// REVISIT: Localize this error message. -Ac
throw new SAXNotSupportedException(
@@ -1534,8 +1537,7 @@
//
if (featureId.startsWith(Constants.SAX_FEATURE_PREFIX)) {
- String feature =
- featureId.substring(Constants.SAX_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.SAX_FEATURE_PREFIX.length();
// http://xml.org/sax/features/namespace-prefixes
// controls the reporting of raw prefixed names and Namespace
@@ -1543,7 +1545,8 @@
// (the default), raw prefixed names may optionally be reported,
// and xmlns* attributes must not be reported.
//
- if (feature.equals(Constants.NAMESPACE_PREFIXES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.NAMESPACE_PREFIXES_FEATURE,
+ 0, Constants.NAMESPACE_PREFIXES_FEATURE.length())) {
boolean state = fConfiguration.getFeature(featureId);
return state;
}
@@ -1551,7 +1554,8 @@
// controls the use of java.lang.String#intern() for strings
// passed to SAX handlers.
//
- if (feature.equals(Constants.STRING_INTERNING_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.STRING_INTERNING_FEATURE,
+ 0, Constants.STRING_INTERNING_FEATURE.length())) {
return true;
}
@@ -1610,15 +1614,16 @@
//
if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.SAX_PROPERTY_PREFIX.length());
+ final int prefixLength = Constants.SAX_PROPERTY_PREFIX.length();
+
//
// http://xml.org/sax/properties/lexical-handler
// Value type: org.xml.sax.ext.LexicalHandler
// Access: read/write, pre-parse only
// Set the lexical event handler.
//
- if (property.equals(Constants.LEXICAL_HANDLER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.LEXICAL_HANDLER_PROPERTY,
+ 0, Constants.LEXICAL_HANDLER_PROPERTY.length())) {
try {
setLexicalHandler((LexicalHandler)value);
}
@@ -1638,7 +1643,8 @@
// Access: read/write, pre-parse only
// Set the DTD declaration event handler.
//
- if (property.equals(Constants.DECLARATION_HANDLER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.DECLARATION_HANDLER_PROPERTY,
+ 0, Constants.DECLARATION_HANDLER_PROPERTY.length())) {
try {
setDeclHandler((DeclHandler)value);
}
@@ -1663,7 +1669,8 @@
// node, it should return null (this is a good way to check for
// availability before the parse begins).
//
- if (property.equals(Constants.DOM_NODE_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.DOM_NODE_PROPERTY,
+ 0, Constants.DOM_NODE_PROPERTY.length())) {
// REVISIT: Localize this error message. -ac
throw new SAXNotSupportedException(
"PAR013 Property \""+propertyId+"\" is read only."
@@ -1728,15 +1735,16 @@
//
if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.SAX_PROPERTY_PREFIX.length());
+ final int prefixLength = Constants.SAX_PROPERTY_PREFIX.length();
+
//
// http://xml.org/sax/properties/lexical-handler
// Value type: org.xml.sax.ext.LexicalHandler
// Access: read/write, pre-parse only
// Set the lexical event handler.
//
- if (property.equals(Constants.LEXICAL_HANDLER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.LEXICAL_HANDLER_PROPERTY,
+ 0, Constants.LEXICAL_HANDLER_PROPERTY.length())) {
return getLexicalHandler();
}
//
@@ -1745,7 +1753,8 @@
// Access: read/write, pre-parse only
// Set the DTD declaration event handler.
//
- if (property.equals(Constants.DECLARATION_HANDLER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.DECLARATION_HANDLER_PROPERTY,
+ 0, Constants.DECLARATION_HANDLER_PROPERTY.length())) {
return getDeclHandler();
}
//
@@ -1758,7 +1767,8 @@
// node, it should return null (this is a good way to check for
// availability before the parse begins).
//
- if (property.equals(Constants.DOM_NODE_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.DOM_NODE_PROPERTY,
+ 0, Constants.DOM_NODE_PROPERTY.length())) {
// REVISIT: Localize this error message. -Ac
throw new SAXNotSupportedException(
"PAR014 Cannot getProperty(\""+propertyId
1.32 +22 -13 xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java
Index: StandardParserConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- StandardParserConfiguration.java 8 May 2003 20:11:58 -0000 1.31
+++ StandardParserConfiguration.java 23 Jan 2004 23:43:39 -0000 1.32
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001, 2002 The Apache Software Foundation.
+ * Copyright (c) 2001-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -294,26 +294,31 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/validation/schema
// Lets the user turn Schema validation support on/off.
//
- if (feature.equals(Constants.SCHEMA_VALIDATION_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_VALIDATION_FEATURE,
+ 0, Constants.SCHEMA_VALIDATION_FEATURE.length())) {
return;
}
// activate full schema checking
- if (feature.equals(Constants.SCHEMA_FULL_CHECKING)) {
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_FULL_CHECKING,
+ 0, Constants.SCHEMA_FULL_CHECKING.length())) {
return;
}
// Feature identifier: expose schema normalized value
// http://apache.org/xml/features/validation/schema/normalized-value
- if(feature.equals(Constants.SCHEMA_NORMALIZED_VALUE)) {
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_NORMALIZED_VALUE,
+ 0, Constants.SCHEMA_NORMALIZED_VALUE.length())) {
return;
}
// Feature identifier: send element default value via characters()
// http://apache.org/xml/features/validation/schema/element-default
- if(feature.equals(Constants.SCHEMA_ELEMENT_DEFAULT)) {
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_ELEMENT_DEFAULT,
+ 0, Constants.SCHEMA_ELEMENT_DEFAULT.length())) {
return;
}
}
@@ -347,19 +352,23 @@
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SCHEMA_LOCATION)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_LOCATION,
+ 0, Constants.SCHEMA_LOCATION.length())) {
return;
}
- if (property.equals(Constants.SCHEMA_NONS_LOCATION)) {
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_NONS_LOCATION,
+ 0, Constants.SCHEMA_NONS_LOCATION.length())) {
return;
}
}
if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.JAXP_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SCHEMA_SOURCE)) {
+ final int prefixLength = Constants.JAXP_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_SOURCE,
+ 0, Constants.SCHEMA_SOURCE.length())) {
return;
}
}
1.13 +56 -38 xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java
Index: XML11Configuration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XML11Configuration.java 1 Dec 2003 05:14:23 -0000 1.12
+++ XML11Configuration.java 23 Jan 2004 23:43:39 -0000 1.13
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001-2003 The Apache Software Foundation.
+ * Copyright (c) 2001-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1209,21 +1209,24 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/validation/dynamic
// Allows the parser to validate a document only when it
// contains a grammar. Validation is turned on/off based
// on each document instance, automatically.
//
- if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DYNAMIC_VALIDATION_FEATURE,
+ 0, Constants.DYNAMIC_VALIDATION_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE,
+ 0, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -1231,7 +1234,8 @@
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_CONTENT_MODELS_FEATURE,
+ 0, Constants.VALIDATE_CONTENT_MODELS_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -1239,20 +1243,23 @@
//
// http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
//
- if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_DTD_GRAMMAR_FEATURE,
+ 0, Constants.LOAD_DTD_GRAMMAR_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
//
- if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_EXTERNAL_DTD_FEATURE,
+ 0, Constants.LOAD_EXTERNAL_DTD_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_DATATYPES_FEATURE,
+ 0, Constants.VALIDATE_DATATYPES_FEATURE.length())) {
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
}
@@ -1261,29 +1268,34 @@
// http://apache.org/xml/features/validation/schema
// Lets the user turn Schema validation support on/off.
//
- if (feature.equals(Constants.SCHEMA_VALIDATION_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_VALIDATION_FEATURE,
+ 0, Constants.SCHEMA_VALIDATION_FEATURE.length())) {
return;
}
// activate full schema checking
- if (feature.equals(Constants.SCHEMA_FULL_CHECKING)) {
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_FULL_CHECKING,
+ 0, Constants.SCHEMA_FULL_CHECKING.length())) {
return;
}
// Feature identifier: expose schema normalized value
// http://apache.org/xml/features/validation/schema/normalized-value
- if(feature.equals(Constants.SCHEMA_NORMALIZED_VALUE)) {
- return;
- }
- // Feature identifier: send element default value via characters()
- // http://apache.org/xml/features/validation/schema/element-default
- if(feature.equals(Constants.SCHEMA_ELEMENT_DEFAULT)) {
- return;
- }
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_NORMALIZED_VALUE,
+ 0, Constants.SCHEMA_NORMALIZED_VALUE.length())) {
+ return;
+ }
+ // Feature identifier: send element default value via characters()
+ // http://apache.org/xml/features/validation/schema/element-default
+ if (featureId.regionMatches(prefixLength, Constants.SCHEMA_ELEMENT_DEFAULT,
+ 0, Constants.SCHEMA_ELEMENT_DEFAULT.length())) {
+ return;
+ }
- // special performance feature: only component manager is allowed to set it.
- if (feature.equals(Constants.PARSER_SETTINGS)) {
- short type = XMLConfigurationException.NOT_SUPPORTED;
- throw new XMLConfigurationException(type, featureId);
- }
+ // special performance feature: only component manager is allowed to set it.
+ if (featureId.regionMatches(prefixLength, Constants.PARSER_SETTINGS,
+ 0, Constants.PARSER_SETTINGS.length())) {
+ short type = XMLConfigurationException.NOT_SUPPORTED;
+ throw new XMLConfigurationException(type, featureId);
+ }
}
@@ -1315,30 +1327,35 @@
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.DTD_SCANNER_PROPERTY,
+ 0, Constants.DTD_SCANNER_PROPERTY.length())) {
+ return;
+ }
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_LOCATION,
+ 0, Constants.SCHEMA_LOCATION.length())) {
+ return;
+ }
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_NONS_LOCATION,
+ 0, Constants.SCHEMA_NONS_LOCATION.length())) {
return;
}
- if (property.equals(Constants.SCHEMA_LOCATION)) {
- return;
- }
- if (property.equals(Constants.SCHEMA_NONS_LOCATION)) {
- return;
- }
}
if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.JAXP_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SCHEMA_SOURCE)) {
+ final int prefixLength = Constants.JAXP_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_SOURCE,
+ 0, Constants.SCHEMA_SOURCE.length())) {
return;
}
}
// special cases
if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.SAX_PROPERTY_PREFIX.length());
+ final int prefixLength = Constants.SAX_PROPERTY_PREFIX.length();
+
//
// http://xml.org/sax/properties/xml-string
// Value type: String
@@ -1349,7 +1366,8 @@
// null (this is a good way to check for availability before the
// parse begins).
//
- if (property.equals(Constants.XML_STRING_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.XML_STRING_PROPERTY,
+ 0, Constants.XML_STRING_PROPERTY.length())) {
// REVISIT - we should probably ask xml-dev for a precise
// definition of what this is actually supposed to return, and
// in exactly which circumstances.
1.11 +24 -15 xml-xerces/java/src/org/apache/xerces/parsers/NonValidatingConfiguration.java
Index: NonValidatingConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/NonValidatingConfiguration.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NonValidatingConfiguration.java 7 Nov 2003 19:47:13 -0000 1.10
+++ NonValidatingConfiguration.java 23 Jan 2004 23:43:39 -0000 1.11
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001, 2002 The Apache Software Foundation.
+ * Copyright (c) 2001-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,6 @@
import org.apache.xerces.impl.XMLEntityManager;
import org.apache.xerces.impl.XMLErrorReporter;
import org.apache.xerces.impl.XMLNSDocumentScannerImpl;
-import org.apache.xerces.impl.XMLNamespaceBinder;
import org.apache.xerces.impl.dv.DTDDVFactory;
import org.apache.xerces.impl.msg.XMLMessageFormatter;
import org.apache.xerces.impl.validation.ValidationManager;
@@ -675,20 +674,23 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/validation/dynamic
// Allows the parser to validate a document only when it
// contains a grammar. Validation is turned on/off based
// on each document instance, automatically.
//
- if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DYNAMIC_VALIDATION_FEATURE,
+ 0, Constants.DYNAMIC_VALIDATION_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE,
+ 0, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -696,7 +698,8 @@
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_CONTENT_MODELS_FEATURE,
+ 0, Constants.VALIDATE_CONTENT_MODELS_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -704,20 +707,23 @@
//
// http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
//
- if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_DTD_GRAMMAR_FEATURE,
+ 0, Constants.LOAD_DTD_GRAMMAR_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
//
- if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_EXTERNAL_DTD_FEATURE,
+ 0, Constants.LOAD_EXTERNAL_DTD_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_DATATYPES_FEATURE,
+ 0, Constants.VALIDATE_DATATYPES_FEATURE.length())) {
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
}
@@ -752,16 +758,19 @@
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.DTD_SCANNER_PROPERTY,
+ 0, Constants.DTD_SCANNER_PROPERTY.length())) {
return;
}
}
if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.JAXP_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SCHEMA_SOURCE)) {
+ final int prefixLength = Constants.JAXP_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_SOURCE,
+ 0, Constants.SCHEMA_SOURCE.length())) {
return;
}
}
1.19 +39 -37 xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java
Index: BasicParserConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- BasicParserConfiguration.java 7 Nov 2003 19:46:01 -0000 1.18
+++ BasicParserConfiguration.java 23 Jan 2004 23:43:39 -0000 1.19
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001, 2002 The Apache Software Foundation.
+ * Copyright (c) 2001-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -560,8 +560,8 @@
// special cases
if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.SAX_PROPERTY_PREFIX.length());
+ final int prefixLength = Constants.SAX_PROPERTY_PREFIX.length();
+
//
// http://xml.org/sax/properties/xml-string
// Value type: String
@@ -572,7 +572,8 @@
// null (this is a good way to check for availability before the
// parse begins).
//
- if (property.equals(Constants.XML_STRING_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.XML_STRING_PROPERTY,
+ 0, Constants.XML_STRING_PROPERTY.length())) {
// REVISIT - we should probably ask xml-dev for a precise
// definition of what this is actually supposed to return, and
// in exactly which circumstances.
@@ -587,39 +588,40 @@
} // checkProperty(String)
- /**
- * Check a feature. If feature is know and supported, this method simply
- * returns. Otherwise, the appropriate exception is thrown.
- *
- * @param featureId The unique identifier (URI) of the feature.
- *
- * @throws XMLConfigurationException Thrown for configuration error.
- * In general, components should
- * only throw this exception if
- * it is <strong>really</strong>
- * a critical error.
- */
- protected void checkFeature(String featureId)
- throws XMLConfigurationException {
-
- //
- // Xerces Features
- //
- if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
-
- //
- // special performance feature: no one by component manager is allowed to set it
- //
- if (feature.equals(Constants.PARSER_SETTINGS)) {
- short type = XMLConfigurationException.NOT_SUPPORTED;
- throw new XMLConfigurationException(type, featureId);
- }
- }
+ /**
+ * Check a feature. If feature is know and supported, this method simply
+ * returns. Otherwise, the appropriate exception is thrown.
+ *
+ * @param featureId The unique identifier (URI) of the feature.
+ *
+ * @throws XMLConfigurationException Thrown for configuration error.
+ * In general, components should
+ * only throw this exception if
+ * it is <strong>really</strong>
+ * a critical error.
+ */
+ protected void checkFeature(String featureId)
+ throws XMLConfigurationException {
+
+ //
+ // Xerces Features
+ //
+ if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
+ //
+ // special performance feature: no one by component manager is allowed to set it
+ //
+ if (featureId.regionMatches(prefixLength, Constants.PARSER_SETTINGS,
+ 0, Constants.PARSER_SETTINGS.length())) {
+ short type = XMLConfigurationException.NOT_SUPPORTED;
+ throw new XMLConfigurationException(type, featureId);
+ }
+ }
- super.checkFeature(featureId);
+ super.checkFeature(featureId);
- } // checkFeature(String)
+ } // checkFeature(String)
-} // class XMLParser
+} // class BasicParserConfiguration
1.16 +20 -11 xml-xerces/java/src/org/apache/xerces/parsers/DTDConfiguration.java
Index: DTDConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DTDConfiguration.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DTDConfiguration.java 25 Jul 2003 18:57:23 -0000 1.15
+++ DTDConfiguration.java 23 Jan 2004 23:43:39 -0000 1.16
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001, 2002 The Apache Software Foundation.
+ * Copyright (c) 2001-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -740,21 +740,24 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/validation/dynamic
// Allows the parser to validate a document only when it
// contains a grammar. Validation is turned on/off based
// on each document instance, automatically.
//
- if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DYNAMIC_VALIDATION_FEATURE,
+ 0, Constants.DYNAMIC_VALIDATION_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE,
+ 0, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -762,7 +765,8 @@
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_CONTENT_MODELS_FEATURE,
+ 0, Constants.VALIDATE_CONTENT_MODELS_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -770,20 +774,23 @@
//
// http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
//
- if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_DTD_GRAMMAR_FEATURE,
+ 0, Constants.LOAD_DTD_GRAMMAR_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
//
- if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_EXTERNAL_DTD_FEATURE,
+ 0, Constants.LOAD_EXTERNAL_DTD_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_DATATYPES_FEATURE,
+ 0, Constants.VALIDATE_DATATYPES_FEATURE.length())) {
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
}
@@ -818,8 +825,10 @@
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.DTD_SCANNER_PROPERTY,
+ 0, Constants.DTD_SCANNER_PROPERTY.length())) {
return;
}
}
1.4 +24 -14 xml-xerces/java/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java
Index: SchemaParsingConfig.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/opti/SchemaParsingConfig.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SchemaParsingConfig.java 7 Nov 2003 19:47:56 -0000 1.3
+++ SchemaParsingConfig.java 23 Jan 2004 23:43:40 -0000 1.4
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001, 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2004 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -614,20 +614,23 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/validation/dynamic
// Allows the parser to validate a document only when it
// contains a grammar. Validation is turned on/off based
// on each document instance, automatically.
//
- if (feature.equals(Constants.DYNAMIC_VALIDATION_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DYNAMIC_VALIDATION_FEATURE,
+ 0, Constants.DYNAMIC_VALIDATION_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE,
+ 0, Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -635,7 +638,8 @@
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_CONTENT_MODELS_FEATURE,
+ 0, Constants.VALIDATE_CONTENT_MODELS_FEATURE.length())) {
// REVISIT
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
@@ -643,20 +647,23 @@
//
// http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
//
- if (feature.equals(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_DTD_GRAMMAR_FEATURE,
+ 0, Constants.LOAD_DTD_GRAMMAR_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
//
- if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_EXTERNAL_DTD_FEATURE,
+ 0, Constants.LOAD_EXTERNAL_DTD_FEATURE.length())) {
return;
}
//
// http://apache.org/xml/features/validation/default-attribute-values
//
- if (feature.equals(Constants.VALIDATE_DATATYPES_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.VALIDATE_DATATYPES_FEATURE,
+ 0, Constants.VALIDATE_DATATYPES_FEATURE.length())) {
short type = XMLConfigurationException.NOT_SUPPORTED;
throw new XMLConfigurationException(type, featureId);
}
@@ -691,16 +698,19 @@
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.DTD_SCANNER_PROPERTY,
+ 0, Constants.DTD_SCANNER_PROPERTY.length())) {
return;
}
}
if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.JAXP_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SCHEMA_SOURCE)) {
+ final int prefixLength = Constants.JAXP_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SCHEMA_SOURCE,
+ 0, Constants.SCHEMA_SOURCE.length())) {
return;
}
}
1.4 +7 -4 xml-xerces/java/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java
Index: CMNodeFactory.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/models/CMNodeFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CMNodeFactory.java 17 Jan 2003 19:43:02 -0000 1.3
+++ CMNodeFactory.java 23 Jan 2004 23:43:40 -0000 1.4
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2003-2004 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -170,13 +170,16 @@
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SECURITY_MANAGER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SECURITY_MANAGER_PROPERTY,
+ 0, Constants.SECURITY_MANAGER_PROPERTY.length())) {
fSecurityManager = (SecurityManager)value;
maxNodeLimit = (fSecurityManager != null) ? fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY : 0 ;
return;
}
- if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.ERROR_REPORTER_PROPERTY,
+ 0, Constants.ERROR_REPORTER_PROPERTY.length())) {
fErrorReporter = (XMLErrorReporter)value;
return;
}
1.31 +8 -6 xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java
Index: XMLNamespaceBinder.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- XMLNamespaceBinder.java 10 Oct 2003 18:25:40 -0000 1.30
+++ XMLNamespaceBinder.java 23 Jan 2004 23:43:40 -0000 1.31
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2004 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -298,12 +298,14 @@
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SYMBOL_TABLE_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SYMBOL_TABLE_PROPERTY,
+ 0, Constants.SYMBOL_TABLE_PROPERTY.length())) {
fSymbolTable = (SymbolTable)value;
}
- else if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) {
+ else if (propertyId.regionMatches(prefixLength, Constants.ERROR_REPORTER_PROPERTY,
+ 0, Constants.ERROR_REPORTER_PROPERTY.length())) {
fErrorReporter = (XMLErrorReporter)value;
}
return;
1.37 +13 -7 xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java
Index: XMLDocumentScannerImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- XMLDocumentScannerImpl.java 5 Jan 2004 21:54:47 -0000 1.36
+++ XMLDocumentScannerImpl.java 23 Jan 2004 23:43:40 -0000 1.37
@@ -389,12 +389,15 @@
// Xerces properties
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
- if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
+ if (featureId.regionMatches(prefixLength, Constants.LOAD_EXTERNAL_DTD_FEATURE,
+ 0, Constants.LOAD_EXTERNAL_DTD_FEATURE.length())) {
fLoadExternalDTD = state;
return;
}
- else if (feature.equals(Constants.DISALLOW_DOCTYPE_DECL_FEATURE)) {
+ else if (featureId.regionMatches(prefixLength, Constants.DISALLOW_DOCTYPE_DECL_FEATURE,
+ 0, Constants.DISALLOW_DOCTYPE_DECL_FEATURE.length())) {
fDisallowDoctype = state;
return;
}
@@ -440,11 +443,14 @@
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.DTD_SCANNER_PROPERTY,
+ 0, Constants.DTD_SCANNER_PROPERTY.length())) {
fDTDScanner = (XMLDTDScanner)value;
}
- if (property.equals(Constants.NAMESPACE_CONTEXT_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.NAMESPACE_CONTEXT_PROPERTY,
+ 0, Constants.NAMESPACE_CONTEXT_PROPERTY.length())) {
if (value != null) {
fNamespaceContext = (NamespaceContext)value;
}
1.72 +16 -10 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java
Index: XMLEntityManager.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- XMLEntityManager.java 19 Jan 2004 22:38:16 -0000 1.71
+++ XMLEntityManager.java 23 Jan 2004 23:43:40 -0000 1.72
@@ -68,7 +68,6 @@
import java.util.Hashtable;
import java.util.Locale;
import java.util.Stack;
-import java.util.Vector;
import org.apache.xerces.impl.io.ASCIIReader;
import org.apache.xerces.impl.io.UCSReader;
@@ -1334,8 +1333,9 @@
// xerces features
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
- if (feature.equals(Constants.ALLOW_JAVA_ENCODINGS_FEATURE)) {
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+ if (featureId.regionMatches(prefixLength, Constants.ALLOW_JAVA_ENCODINGS_FEATURE,
+ 0, Constants.ALLOW_JAVA_ENCODINGS_FEATURE.length())) {
fAllowJavaEncodings = state;
}
}
@@ -1371,20 +1371,25 @@
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SYMBOL_TABLE_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SYMBOL_TABLE_PROPERTY,
+ 0, Constants.SYMBOL_TABLE_PROPERTY.length())) {
fSymbolTable = (SymbolTable)value;
return;
}
- if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.ERROR_REPORTER_PROPERTY,
+ 0, Constants.ERROR_REPORTER_PROPERTY.length())) {
fErrorReporter = (XMLErrorReporter)value;
return;
}
- if (property.equals(Constants.ENTITY_RESOLVER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.ENTITY_RESOLVER_PROPERTY,
+ 0, Constants.ENTITY_RESOLVER_PROPERTY.length())) {
fEntityResolver = (XMLEntityResolver)value;
return;
}
- if (property.equals(Constants.BUFFER_SIZE_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.BUFFER_SIZE_PROPERTY,
+ 0, Constants.BUFFER_SIZE_PROPERTY.length())) {
Integer bufferSize = (Integer)value;
if (bufferSize != null &&
bufferSize.intValue() > DEFAULT_XMLDECL_BUFFER_SIZE) {
@@ -1392,7 +1397,8 @@
fEntityScanner.setBufferSize(fBufferSize);
}
}
- if (property.equals(Constants.SECURITY_MANAGER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.SECURITY_MANAGER_PROPERTY,
+ 0, Constants.SECURITY_MANAGER_PROPERTY.length())) {
fSecurityManager = (SecurityManager)value;
fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
}
1.43 +7 -5 xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java
Index: XMLDocumentFragmentScannerImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- XMLDocumentFragmentScannerImpl.java 5 Jan 2004 21:54:28 -0000 1.42
+++ XMLDocumentFragmentScannerImpl.java 23 Jan 2004 23:43:40 -0000 1.43
@@ -428,8 +428,9 @@
// Xerces properties
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
- if (feature.equals(Constants.NOTIFY_BUILTIN_REFS_FEATURE)) {
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+ if (featureId.regionMatches(prefixLength, Constants.NOTIFY_BUILTIN_REFS_FEATURE,
+ 0, Constants.NOTIFY_BUILTIN_REFS_FEATURE.length())) {
fNotifyBuiltInRefs = state;
}
}
@@ -467,8 +468,9 @@
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.ENTITY_MANAGER_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+ if (propertyId.regionMatches(prefixLength, Constants.ENTITY_MANAGER_PROPERTY,
+ 0, Constants.ENTITY_MANAGER_PROPERTY.length())) {
fEntityManager = (XMLEntityManager)value;
}
return;
1.12 +13 -8 xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java
Index: XMLErrorReporter.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XMLErrorReporter.java 8 May 2003 20:11:54 -0000 1.11
+++ XMLErrorReporter.java 23 Jan 2004 23:43:40 -0000 1.12
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation.
+ * Copyright (c) 1999-2004 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -457,13 +457,15 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/continue-after-fatal-error
// Allows the parser to continue after a fatal error.
// Normally, a fatal error would stop the parse.
//
- if (feature.equals(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE,
+ 0, Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE.length())) {
fContinueAfterFatalError = state;
}
}
@@ -479,13 +481,15 @@
//
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
- String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
+ final int prefixLength = Constants.XERCES_FEATURE_PREFIX.length();
+
//
// http://apache.org/xml/features/continue-after-fatal-error
// Allows the parser to continue after a fatal error.
// Normally, a fatal error would stop the parse.
//
- if (feature.equals(Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE)) {
+ if (featureId.regionMatches(prefixLength, Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE,
+ 0, Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE.length())) {
return fContinueAfterFatalError ;
}
}
@@ -525,9 +529,10 @@
//
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
- if (property.equals(Constants.ERROR_HANDLER_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.ERROR_HANDLER_PROPERTY,
+ 0, Constants.ERROR_HANDLER_PROPERTY.length())) {
fErrorHandler = (XMLErrorHandler)value;
}
}
1.42 +9 -6 xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java
Index: XMLScanner.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- XMLScanner.java 5 Jan 2004 21:54:58 -0000 1.41
+++ XMLScanner.java 23 Jan 2004 23:43:40 -0000 1.42
@@ -305,15 +305,18 @@
// Xerces properties
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.SYMBOL_TABLE_PROPERTY)) {
+ final int prefixLength = Constants.XERCES_PROPERTY_PREFIX.length();
+
+ if (propertyId.regionMatches(prefixLength, Constants.SYMBOL_TABLE_PROPERTY,
+ 0, Constants.SYMBOL_TABLE_PROPERTY.length())) {
fSymbolTable = (SymbolTable)value;
}
- else if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) {
+ else if (propertyId.regionMatches(prefixLength, Constants.ERROR_REPORTER_PROPERTY,
+ 0, Constants.ERROR_REPORTER_PROPERTY.length())) {
fErrorReporter = (XMLErrorReporter)value;
}
- else if (property.equals(Constants.ENTITY_MANAGER_PROPERTY)) {
+ else if (propertyId.regionMatches(prefixLength, Constants.ENTITY_MANAGER_PROPERTY,
+ 0, Constants.ENTITY_MANAGER_PROPERTY.length())) {
fEntityManager = (XMLEntityManager)value;
}
}
1.16 +5 -4 xml-xerces/java/src/org/apache/xerces/dom/DOMConfigurationImpl.java
Index: DOMConfigurationImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMConfigurationImpl.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DOMConfigurationImpl.java 24 Dec 2003 16:24:20 -0000 1.15
+++ DOMConfigurationImpl.java 23 Jan 2004 23:43:40 -0000 1.16
@@ -1034,8 +1034,8 @@
// special cases
if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.SAX_PROPERTY_PREFIX.length());
+ final int prefixLength = Constants.SAX_PROPERTY_PREFIX.length();
+
//
// http://xml.org/sax/properties/xml-string
// Value type: String
@@ -1046,7 +1046,8 @@
// null (this is a good way to check for availability before the
// parse begins).
//
- if (property.equals(Constants.XML_STRING_PROPERTY)) {
+ if (propertyId.regionMatches(prefixLength, Constants.XML_STRING_PROPERTY,
+ 0, Constants.XML_STRING_PROPERTY.length())) {
// REVISIT - we should probably ask xml-dev for a precise
// definition of what this is actually supposed to return, and
// in exactly which circumstances.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org