You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Sam Ruby <ru...@us.ibm.com> on 2001/12/07 22:14:47 UTC

[PATCH] Support for released and upcoming versions of xml-xalan...

Disclaimer: I've verified that the following COMPILES against both the
xalan-2.0.1.jar contained within the xml-xindice cvs AND against the
lastest xml-xalan2 compiled from cvs.  I've done NO execution testing.
However, based on prior discussions with the Xalan team, I have reason to
believe that this change may actually improve performance under both
versions.  I don't pretend that this will solve the overall performance
problems you apparently are seeing with the latest xalan developer
releases, but at least by being version agnostic, your users can choose the
version that best suits their needs.

Index: XPathQueryResolver.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java,v
retrieving revision 1.1
diff -u -r1.1 XPathQueryResolver.java
--- XPathQueryResolver.java   2001/12/06 21:00:14  1.1
+++ XPathQueryResolver.java   2001/12/07 20:51:34
@@ -70,6 +70,7 @@
 import org.apache.xindice.xml.dom.*;

 import org.w3c.dom.*;
+import org.w3c.dom.traversal.NodeIterator;

 import java.util.*;

@@ -964,9 +965,7 @@

       public Key[] keySet;
       public int keyPos = 0;
-      public NodeList nl;
-      public int nlPos = 0;
-      public int nlSize = 0;
+      public NodeIterator ni;
       public Node node;

       public ResultSet(Collection context, PrefixResolver pr, Key[] keySet, String query) {
@@ -1015,14 +1014,10 @@
                      xp = new XPath(query, null, pfx, XPath.SELECT, errors);
                }

-               nl = xp.execute(xpc, n, pfx).mutableNodeset();
+               ni = xp.execute(xpc, n, pfx).nodeset();

-               nlSize = nl.getLength();
-               if ( nlSize == 0 )
-                  continue;
-               else {
-                  nlPos = 1;
-                  node = nl.item(0);
+               node = ni.nextNode();
+               if ( node != null ) {
                   break;
                }
             }
@@ -1039,9 +1034,8 @@
       public Node getNextNode() {
          Node n = node;

-         if ( nlPos < nlSize )
-            node = nl.item(nlPos++);
-         else
+         node = ni.nextNode();
+         if ( node == null )
             prepareNextNode();

          return n;

- Sam Ruby


Re: [PATCH] Support for released and upcoming versions of xml-xalan...

Posted by Tom Bradford <br...@dbxmlgroup.com>.
Tom Bradford wrote:
> 
> Sam Ruby wrote:
> >
> > Disclaimer: I've verified that the following COMPILES against both the
> > xalan-2.0.1.jar contained within the xml-xindice cvs AND against the
> > lastest xml-xalan2 compiled from cvs.  I've done NO execution testing.
> > However, based on prior discussions with the Xalan team, I have reason to
> > believe that this change may actually improve performance under both
> > versions.  I don't pretend that this will solve the overall performance
> > problems you apparently are seeing with the latest xalan developer
> > releases, but at least by being version agnostic, your users can choose the
> > version that best suits their needs.
> 
> Thank Sam, I'll try it out this afternoon.

Just added it..  It looks good, and seems to perform a bit better.

-- 
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean

Re: [PATCH] Support for released and upcoming versions of xml-xalan...

Posted by Tom Bradford <br...@dbxmlgroup.com>.
Sam Ruby wrote:
> 
> Disclaimer: I've verified that the following COMPILES against both the
> xalan-2.0.1.jar contained within the xml-xindice cvs AND against the
> lastest xml-xalan2 compiled from cvs.  I've done NO execution testing.
> However, based on prior discussions with the Xalan team, I have reason to
> believe that this change may actually improve performance under both
> versions.  I don't pretend that this will solve the overall performance
> problems you apparently are seeing with the latest xalan developer
> releases, but at least by being version agnostic, your users can choose the
> version that best suits their needs.

Thank Sam, I'll try it out this afternoon.

-- 
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (formerly dbXML)
Maintainer - jEdit-Syntax Java Editing Bean