[JXPath] evaluating if a node exists

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[JXPath] evaluating if a node exists

Laurent Perez
Hello

I'm trying to figure out how to "tell" if a given node, or expression,
exists or not, possibly using a boolean approach, but whatever I'm
trying, I'm facing a ClassCastException, and I don't understand why
:-(

Here the xpath expression I'm using (this one causing classcast) :

Boolean assisted =
(Boolean)ctx.getValue("./Action_Lists/Action_List/Action_Line/Time[@Type='A']/../preceding::Action_Line[position()
= 1]/Action[@Type='AST_A']");

(I've also tried the getValue("expr", Boolean.class);, no luck)

In short, an <Action_Line> node having an <Action Type="AST_A"> child
may (or may not) be present before another <Action_Line> with a <Time
Type='A'> child, and I'm trying to evaluate this. Is there a correct
method to understand if a given expression returns "something" (I was
hoping the bool would return true or false, but it doesn't seem to) ?

Thanks for any support :)

Laurent

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]