commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Perez <hak...@gmail.com>
Subject [JXPath] evaluating if a node exists
Date Mon, 20 Jun 2005 16:16:21 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message