[jira] Created: (JXPATH-114) node() implementation in DOM and JDOM model

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (JXPATH-114) node() implementation in DOM and JDOM model

JIRA jira@apache.org
node() implementation in DOM and JDOM model
-------------------------------------------

                 Key: JXPATH-114
                 URL: https://issues.apache.org/jira/browse/JXPATH-114
             Project: Commons JXPath
          Issue Type: Bug
            Reporter: Michele Vivoda
            Priority: Minor


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);



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (JXPATH-114) node() implementation in DOM and JDOM model

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/JXPATH-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554302 ]

Matt Benson commented on JXPATH-114:
------------------------------------

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

> node() implementation in DOM and JDOM model
> -------------------------------------------
>
>                 Key: JXPATH-114
>                 URL: https://issues.apache.org/jira/browse/JXPATH-114
>             Project: Commons JXPath
>          Issue Type: Bug
>            Reporter: Michele Vivoda
>            Priority: Minor
>
> 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);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (JXPATH-114) node() implementation in DOM and JDOM model

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/JXPATH-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554347 ]

Michele Vivoda commented on JXPATH-114:
---------------------------------------

Sure, I forgot....

XPath: count(//node())
XML:
<root><a foo='34'>123.3</a><!-- com --><a attr='34.3'>34.3<!-- om --></a></root>

xalan and saxon result is 7, jxpath gives 3.


> node() implementation in DOM and JDOM model
> -------------------------------------------
>
>                 Key: JXPATH-114
>                 URL: https://issues.apache.org/jira/browse/JXPATH-114
>             Project: Commons JXPath
>          Issue Type: Bug
>            Reporter: Michele Vivoda
>            Priority: Minor
>
> 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);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (JXPATH-114) node() implementation in DOM and JDOM model

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/JXPATH-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson resolved JXPATH-114.
--------------------------------

    Resolution: Fixed

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

> node() implementation in DOM and JDOM model
> -------------------------------------------
>
>                 Key: JXPATH-114
>                 URL: https://issues.apache.org/jira/browse/JXPATH-114
>             Project: Commons JXPath
>          Issue Type: Bug
>            Reporter: Michele Vivoda
>            Priority: Minor
>
> 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);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (JXPATH-114) node() implementation in DOM and JDOM model

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/JXPATH-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated JXPATH-114:
-------------------------------

    Fix Version/s: 1.3

> node() implementation in DOM and JDOM model
> -------------------------------------------
>
>                 Key: JXPATH-114
>                 URL: https://issues.apache.org/jira/browse/JXPATH-114
>             Project: Commons JXPath
>          Issue Type: Bug
>            Reporter: Michele Vivoda
>            Priority: Minor
>             Fix For: 1.3
>
>
> 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);

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.