You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2002/05/15 18:57:22 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref DTMDefaultBaseIterators.java

jkesselm    02/05/15 09:57:22

  Modified:    java/src/org/apache/xml/dtm/ref Tag: Xalan3
                        DTMDefaultBaseIterators.java
  Log:
  Bugzilla 8324: Preceeding axis should not include namespace
  or attribute nodes. See also axes126.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.6.2  +19 -15    xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java
  
  Index: DTMDefaultBaseIterators.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java,v
  retrieving revision 1.11.6.1
  retrieving revision 1.11.6.2
  diff -u -r1.11.6.1 -r1.11.6.2
  --- DTMDefaultBaseIterators.java	29 Apr 2002 17:49:32 -0000	1.11.6.1
  +++ DTMDefaultBaseIterators.java	15 May 2002 16:57:22 -0000	1.11.6.2
  @@ -402,7 +402,7 @@
   
         _currentNode = END;
   
  -      return returnNode(result);
  +      return result;
       }
     }  // end of ParentIterator
   
  @@ -1122,7 +1122,7 @@
     /**
      * Iterator that returns preceding nodes of a given node.
      * This includes the node set {root+1, start-1}, but excludes
  -   * all ancestors.
  +   * all ancestors, attributes, and namespace nodes.
      */
     private class PrecedingIterator extends InternalAxisIteratorBase
     {
  @@ -1231,19 +1231,23 @@
        */
       public int next()
       {
  -
  -      int node = _currentNode + 1;
  -
  -      if ((_sp >= 0) && (node < _stack[_sp]))
  -      {
  -        return returnNode(makeNodeHandle(_currentNode = node));
  -      }
  -      else
  -      {
  -        _currentNode = node;  // skip ancestor
  -
  -        return --_sp >= 0 ? next() : NULL;
  -      }
  +    	// Bugzilla 8324: We were forgetting to skip Attrs and NS nodes.
  +    	// Also recoded the loop controls for clarity and to flatten out
  +    	// the tail-recursion.
  +   		for(++_currentNode; 
  +   			_sp>=0; 
  +   			++_currentNode)
  +   		{
  +   			if(_currentNode < _stack[_sp])
  +   			{
  +   				if(_type(_currentNode) != ATTRIBUTE_NODE &&
  +   					_type(_currentNode) != NAMESPACE_NODE)
  +   					return returnNode(makeNodeHandle(_currentNode));
  +   			}
  +   			else
  +   				--_sp;
  +   		}
  +   		return NULL;
       }
   
       // redefine DTMAxisIteratorBase's reset
  
  
  

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