Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.2.16
-
None
-
Mac OS X
Description
The iterator obtained by OMDocument.getDescendants(true) returns the document node itself, and no further nodes. The problem is new in 1.2.16, and causes Saxon's XPath processor to deliver incorrect results when running against an Axiom document. The problem appears to be in AbstractNodeIterator, which is apparently new in 1.2.16. The problem is demonstrated by the following test case:
public void testDescendantAxis() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMDocument document = factory.createOMDocument();
OMElement element = factory.createOMElement("test", null);
document.setOMDocumentElement(element);
Iterator iter = document.getDescendants(true);
int count = 0;
while (iter.hasNext())
assertEquals("Two nodes", 2, count);
System.err.println(count);
}
Running in the debugger, the document node is returned OK, but the iterator is left in a state where the following call on hasNext() returns false.