mmidy 2002/07/10 11:57:00 Modified: java/src/org/apache/xml/dtm/ref DTMDefaultBaseIterators.java Log: bugzilla 9575: Fix AncestorIterator counting root node twice. Patch from Henry Zongaro. Revision Changes Path 1.15 +11 -9 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- DTMDefaultBaseIterators.java 16 May 2002 23:38:41 -0000 1.14 +++ DTMDefaultBaseIterators.java 10 Jul 2002 18:57:00 -0000 1.15 @@ -1491,8 +1491,6 @@ else _startNode = getParent(node); - _currentNode = getDocumentRoot(node); - node = _startNode; while (node != END) { @@ -1501,6 +1499,10 @@ } m_ancestorsPos = m_ancestors.size()-1; + _currentNode = (m_ancestorsPos>=0) + ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; + return resetPosition(); } @@ -1516,10 +1518,11 @@ public DTMAxisIterator reset() { - _currentNode = getDocumentRoot(_startNode); - m_ancestorsPos = m_ancestors.size()-1; + _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; + return resetPosition(); } @@ -1533,11 +1536,10 @@ int next = _currentNode; - int pos = m_ancestorsPos--; - if(pos < 0) - _currentNode = DTM.NULL; - else - _currentNode = m_ancestors.elementAt(pos); + int pos = --m_ancestorsPos; + + _currentNode = (pos >= 0) ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; return returnNode(next); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]