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 br...@apache.org on 2001/12/07 22:49:54 UTC

cvs commit: xml-xindice/java/src/org/apache/xindice/core/query XPathQueryResolver.java

bradford    01/12/07 13:49:54

  Modified:    java/src/org/apache/xindice/core/query
                        XPathQueryResolver.java
  Log:
  Added Xalan compatibility fix submitted by Sam Ruby
  Submitted by:	Sam Ruby <ru...@us.ibm.com>
  
  Revision  Changes    Path
  1.2       +9 -16     xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java
  
  Index: XPathQueryResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPathQueryResolver.java	2001/12/06 21:00:14	1.1
  +++ XPathQueryResolver.java	2001/12/07 21:49:54	1.2
  @@ -56,7 +56,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * $Id: XPathQueryResolver.java,v 1.1 2001/12/06 21:00:14 bradford Exp $
  + * $Id: XPathQueryResolver.java,v 1.2 2001/12/07 21:49:54 bradford Exp $
    */
   
   import org.apache.xindice.core.*;
  @@ -70,6 +70,7 @@
   import org.apache.xindice.xml.dom.*;
   
   import org.w3c.dom.*;
  +import org.w3c.dom.traversal.*;
   
   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,16 +1014,11 @@
                        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;
  -               }
               }
               catch ( Exception e ) {
                  org.apache.xindice.Debug.printStackTrace(e);
  @@ -1038,10 +1032,9 @@
      
         public Node getNextNode() {
            Node n = node;
  -         
  -         if ( nlPos < nlSize )
  -            node = nl.item(nlPos++);
  -         else
  +
  +         node = ni.nextNode();
  +         if ( node == null )
               prepareNextNode();
   
            return n;