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

Descendant or self axis does not work correctly at root node

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2 Final
    • 1.3
    • None
    • Operating System: other
      Platform: Other

    • 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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment