mrglavas 2004/08/22 18:28:41
Modified: java/src/org/apache/xerces/dom CoreDocumentImpl.java
Log:
Once we've created an XPathEvaluator, cache it to avoid
looking it up again and creating it using reflection.
Revision Changes Path
1.77 +12 -2 xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
Index: CoreDocumentImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- CoreDocumentImpl.java 17 Aug 2004 19:37:44 -0000 1.76
+++ CoreDocumentImpl.java 23 Aug 2004 01:28:41 -0000 1.77
@@ -131,6 +131,9 @@
// DOM Level 3: normalizeDocument
transient DOMNormalizer domNormalizer = null;
transient DOMConfigurationImpl fConfiguration = null;
+
+ // support of XPath API
+ transient Object fXPathEvaluator = null;
/** Table for quick check of child insertion. */
private final static int[] kidOK;
@@ -489,6 +492,12 @@
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
+ // If an XPathEvaluator was created previously
+ // return it otherwise create a new one.
+ if (fXPathEvaluator != null) {
+ return fXPathEvaluator;
+ }
+
try {
Class xpathClass = ObjectFactory.findProviderClass(
"org.apache.xpath.domapi.XPathEvaluatorImpl",
@@ -502,7 +511,8 @@
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
- return xpathClassConstr.newInstance(new Object[] { this });
+ fXPathEvaluator = xpathClassConstr.newInstance(new Object[]
{ this });
+ return fXPathEvaluator;
}
}
return null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]