DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7885>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7885

Using Axis.DESCENDANT with a DTMAxisIterator, getLast() causes erronous results

           Summary: Using Axis.DESCENDANT with a DTMAxisIterator, getLast()
                    causes erronous results
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xml.dtm
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


REFER TO NEW TEST TestDTMIterator !! This will require updating xml-xalan/test
directory!!!

Given a string source that is based on the following:
String defaultSource="<?xml version=\"1.0\"?>\n"+                       
        "<Document>"+                   
        "<A><B><C><D><E><F/></E></D></C></B></A><Aa/>"+
        "</Document>";

// Creating an Iterator of Descendants, 
DTMAxisIterator iter2 = dtm.getAxisIterator(Axis.DESCENDANT);
iter2.setStartNode(sndChild); // <A>
          
// Iterate the axis and print out node info.
int lastNode= 0;
for (int nextNode = iter2.next(); DTM.NULL != nextNode; nextNode=iter2.next())
{
   printNode(dtm, iter2, nextNode, " ");
   lastNode = nextNode;
   System.out.println("****** lastNode="+dtm.getNodeName(lastNode));
}
lastNode = iter2.getLast();      // Calling this seems to generate bad results.

// Get a third itertor of Ancestors starting from the last descendant
// of previous iterator, i.e. lastNode.
DTMAxisIterator revIter = dtm.getAxisIterator(Axis.ANCESTOR);
revIter.setStartNode(lastNode);

System.out.println("#### Third Iterator\n");
// Iterate the axis and print out node info.
for (int nextNode=revIter.next(); DTM.NULL!=nextNode; nextNode=revIter.next())
     printNode(dtm, revIter, nextNode, " ");

}
The results will be all wrong, or an exception will be thrown.

Reply via email to