You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Michael Kay (JIRA)" <ji...@apache.org> on 2015/12/08 22:26:10 UTC

[jira] [Created] (AXIOM-476) Descendant-or-self starting at document node fails to reach elements

Michael Kay created AXIOM-476:
---------------------------------

             Summary: Descendant-or-self starting at document node fails to reach elements
                 Key: AXIOM-476
                 URL: https://issues.apache.org/jira/browse/AXIOM-476
             Project: Axiom
          Issue Type: Bug
          Components: API
    Affects Versions: 1.2.16
         Environment: Mac OS X
            Reporter: Michael Kay


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()) {
            Object o = iter.next();
            count++;
        }
        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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org