Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-12

Descendant or self axis does not work correctly at root node

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2 Final
    • Fix Version/s: 1.3
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

    • Bugzilla Id:
      38586

      Description

      Given the following XML document: <root id="1234"/>
      and the XPath: //root/@id/text().

      JXPath returns null instead of "1234".

      JXPathContext context = JXPathContext.newContext(doc);
      assertEquals(value, context.selectSingleNode("//root/@id/text()"));

      The attached JUnit test highlights the problem. It seems that JXPath does not
      find the root node if it is accessed with the axis descendant-or-self.

        Attachments

        1. xpathEvalBug.zip
          1 kB
          Murty Gurajada
        2. patch.jxpath-12.txt
          3 kB
          Marcin Sarniak
        3. ASF.LICENSE.NOT.GRANTED--DescendantOrSelfTest.java
          0.6 kB
          Simon Raess

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cocoa Simon Raess
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: