2

With VTD-XML, is it possible to execute the following XPath statement?

if(10 > 5) then "yes" else "no"`

I have a much more complex statement, but it will not run with my current setup. There are these methods possible: evalXPathToBoolean(), evalXPathToNumber(), and evalXpathToString(). But, I am receiving this error when trying to execute:

com.ximpleware.extended.XPathParseExceptionHuge: XPath Syntax error: #8

autoPilot.selectXPath(xpath) // does not like this
while((i=autoPilot.evalXPath())!=-1){        
list.add(vtdNav.toString(i));
}

This is valid XPath and works in XMLSpy. Is it possible to do this with VTD-XML? Please advise.

LimaNightHawk
  • 6,613
  • 3
  • 41
  • 60
vScanger
  • 21
  • 1
  • Please note, I know that I could use evalXPathToBoolean() to return true or false, but the conditional logic is much more complex and, ultimately, a string will have to be returned based upon another XPath statement that will be run. – vScanger May 19 '16 at 15:59

1 Answers1

0

VTD-XML supports full set of XPath 1.0. The syntax you alluded to is likely XPath 2.0 syntax... which is not supported by VTD-XML at this point.

The solution/work-around is to take your conditional statement and code it into your application logic, and only use VTD-XML XPath boolean/number evaluation capability to obtain the values , which you can then weave into your condition logic...

vtd-xml-author
  • 3,319
  • 4
  • 22
  • 30