You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dm...@apache.org on 2002/08/10 03:32:38 UTC

cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes DescendantContext.java

dmitri      2002/08/09 18:32:38

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/axes
                        DescendantContext.java
  Log:
  Fixed a problem with descendent:: axis returning non-elements
  
  Revision  Changes    Path
  1.8       +12 -6     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java
  
  Index: DescendantContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/axes/DescendantContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DescendantContext.java	28 Apr 2002 04:35:48 -0000	1.7
  +++ DescendantContext.java	10 Aug 2002 01:32:38 -0000	1.8
  @@ -64,6 +64,8 @@
   import java.util.Stack;
   
   import org.apache.commons.jxpath.ri.EvalContext;
  +import org.apache.commons.jxpath.ri.QName;
  +import org.apache.commons.jxpath.ri.compiler.NodeNameTest;
   import org.apache.commons.jxpath.ri.compiler.NodeTest;
   import org.apache.commons.jxpath.ri.model.NodeIterator;
   import org.apache.commons.jxpath.ri.model.NodePointer;
  @@ -81,6 +83,8 @@
       private Stack stack;
       private NodePointer currentNodePointer;
       private boolean includeSelf;
  +    private final static NodeTest elementNodeTest = 
  +            new NodeNameTest(new QName(null, "*"));
   
       public DescendantContext(EvalContext parentContext, boolean includeSelf, NodeTest nodeTest){
           super(parentContext);
  @@ -123,7 +127,8 @@
               currentNodePointer = parentContext.getCurrentNodePointer();
               if (currentNodePointer != null){
                   if (!currentNodePointer.isLeaf()){
  -                    stack.push(currentNodePointer.childIterator(null, false, null));
  +                    stack.push(currentNodePointer.childIterator(
  +                            elementNodeTest, false, null));
                   }
                   if (includeSelf){
                       if (currentNodePointer.testNode(nodeTest)){
  @@ -139,7 +144,8 @@
               if (it.setPosition(it.getPosition() + 1)){
                   currentNodePointer = it.getNodePointer();
                   if (!currentNodePointer.isLeaf()){
  -                    stack.push(currentNodePointer.childIterator(null, false, null));
  +                    stack.push(currentNodePointer.childIterator(
  +                        elementNodeTest, false, null));
                   }
                   if (currentNodePointer.testNode(nodeTest)){
                       position++;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>