[
https://issues.apache.org/jira/browse/JXPATH-148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Benson resolved JXPATH-148.
--------------------------------
Resolution: Invalid
Per the XPath 1.0 spec, an expression evaluates to a node-set. A node-set
evaluates to a boolean based on its having content. The first way I've found
to accomplish this is to wrap the boolean path access in the number() function,
which extracts the first value from the node-set and converts it to a number,
which can then be converted back to a boolean for the purposes of the
relational operation.
> false and false returns true
> ----------------------------
>
> Key: JXPATH-148
> URL: https://issues.apache.org/jira/browse/JXPATH-148
> Project: Commons JXPath
> Issue Type: Bug
> Affects Versions: 1.3
> Environment: WindowsXP
> Reporter: Johannes Stelzer
> Priority: Blocker
> Attachments: Issue148Test.java
>
>
> Map<String, Object> map = new HashMap<String, Object>();
> map.put("h", false);
> JXPathContext c = JXPathContext.newContext(map);
> System.out.println(c.getValue("h and h "));
> Prints: true !!! it should print false!
> System.out.println(c.getValue("h = true() and h = true()")); although prints
> correctly: false
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira