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

node() implementation in DOM and JDOM model

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Labels:
      None

      Description

      I think that the code in DOMNodePointer.java, line 120 is wrong because considers only element and document to be matched by node().
      while instead it matches any node that pass from there.

      case Compiler.NODE_TYPE_NODE :
      return nodeType == Node.ELEMENT_NODE

      nodeType == Node.DOCUMENT_NODE;

      should be changed to

      case Compiler.NODE_TYPE_NODE :
      return true;

      Same in JDOMNodePointer, line 391

      return true;//(node instanceof Element) || (node instanceof Document);

        Activity

        Hide
        mbenson Matt Benson added a comment -

        Any chance of a testcase, or at least a hint thereof?

        Show
        mbenson Matt Benson added a comment - Any chance of a testcase, or at least a hint thereof?
        Hide
        vivodamichele@hotmail.com Michele Vivoda added a comment -

        Sure, I forgot....

        XPath: count(//node())
        XML:
        <root><a foo='34'>123.3</a><Unable to render embedded object: File (-- com --><a attr='34.3'>34.3<) not found.-- om --></a></root>

        xalan and saxon result is 7, jxpath gives 3.

        Show
        vivodamichele@hotmail.com Michele Vivoda added a comment - Sure, I forgot.... XPath: count(//node()) XML: <root><a foo='34'>123.3</a>< Unable to render embedded object: File (-- com --><a attr='34.3'>34.3<) not found. -- om --></a></root> xalan and saxon result is 7, jxpath gives 3.
        Hide
        mbenson Matt Benson added a comment -

        After quite some analysis, I agree with your findings, Michele. This is fixed with svn commit 617923.

        Show
        mbenson Matt Benson added a comment - After quite some analysis, I agree with your findings, Michele. This is fixed with svn commit 617923.

          People

          • Assignee:
            Unassigned
            Reporter:
            vivodamichele@hotmail.com Michele Vivoda
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development