Affects Version/s: 1.2 Final
Fix Version/s: 1.3
1.2, SVN version
According to XPath specification:
"If both objects to be compared are node-sets, then the comparison will be true if and only if there is a node in the first node-set and a node in the second node-set such that the result of performing the comparison on the string-values of the two nodes is true. If one object to be compared is a node-set and the other is a number, then the comparison will be true if and only if there is a node in the node-set such that the result of performing the comparison on the number to be compared and on the result of converting the string-value of that node to a number using the number function is true."
But following example illustrates, that this is not a JXPath behaviour:
JXPathContext pathContext = JXPathContext
new InputSource(new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
Boolean result = (Boolean) pathContext.getValue("2.0 > child1",
"child1" is not found - right operand node set is empty, but result is TRUE, instead of FALSE.
Please, check greaterThan(), lesserThan(), etc methods of org.apache.xpath.objects.XObject for possible solution