xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zong...@apache.org
Subject svn commit: r524807 - /xalan/java/trunk/src/org/apache/xpath/XPathAPI.java
Date Mon, 02 Apr 2007 15:51:44 GMT
Author: zongaro
Date: Mon Apr  2 08:51:43 2007
New Revision: 524807

URL: http://svn.apache.org/viewvc?view=rev&rev=524807
Log:
Part of fix for Jira issue XALANJ-2375.

Added a new constructor and corresponding reset method that allow the caller
to specify the initial size for the arrays contained in a VariableStack.  This
is important for XPath expression evaluation, where additional stack entries
are never needed.  Previously, the arrays were always allocated based on the
maximum recursion depth permitted by the XSLT processor, which was caused
unnecessary initialization overhead using the various XPath APIs.

Also added two new XPathContext constructors which accept a boolean argument
that indicates whether the context for variables needs to be push/popable.
When it's false, the XPathContext will create a minimally-sized VariableStack.

Reviewed by Christine Li (jycli () ca ! ibm ! com).

Modified:
    xalan/java/trunk/src/org/apache/xpath/XPathAPI.java

Modified: xalan/java/trunk/src/org/apache/xpath/XPathAPI.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xpath/XPathAPI.java?view=diff&rev=524807&r1=524806&r2=524807
==============================================================================
--- xalan/java/trunk/src/org/apache/xpath/XPathAPI.java (original)
+++ xalan/java/trunk/src/org/apache/xpath/XPathAPI.java Mon Apr  2 08:51:43 2007
@@ -220,7 +220,9 @@
     // (Changed from: XPathContext xpathSupport = new XPathContext();
     //    because XPathContext is weak in a number of areas... perhaps
     //    XPathContext should be done away with.)
-    XPathContext xpathSupport = new XPathContext();
+    // Create an XPathContext that doesn't support pushing and popping of
+    // variable resolution scopes.  Sufficient for simple XPath 1.0 expressions.
+    XPathContext xpathSupport = new XPathContext(false);
 
     // Create an object to resolve namespace prefixes.
     // XPath namespaces are resolved from the input context node's document element
@@ -274,8 +276,11 @@
     // Create the XPath object.
     XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
 
+    // Create an XPathContext that doesn't support pushing and popping of
+    // variable resolution scopes.  Sufficient for simple XPath 1.0 expressions.
+    XPathContext xpathSupport = new XPathContext(false);
+
     // Execute the XPath, and have it return the result
-    XPathContext xpathSupport = new XPathContext();
     int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
 
     return xpath.execute(xpathSupport, ctxtNode, prefixResolver);



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message