Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-476

Descendant-or-self starting at document node fails to reach elements

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.16
    • Fix Version/s: 1.2.17
    • Component/s: Core Model
    • Labels:
      None
    • Environment:
      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())

      { 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.

        Attachments

          Activity

            People

            • Assignee:
              veithen Andreas Veithen
              Reporter:
              mike@saxonica.com Michael Kay
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: