commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Laplante <nicolas.lapla...@gmail.com>
Subject Re: JXPath nested property
Date Sat, 03 Feb 2007 19:28:19 GMT
Found a solution to this issue, using relative contexts:

JXPathContext ctx = JXPathContext.newContext(/* get the List<State> here 
*/);
JXPathContext relativeCtx;                   

Iterator<Pointer> it = (Iterator<Pointer>) 
ctx.iteratePointers("country[@id = " + countryId + "]");
                   
while (it.hasNext()) {
    relativeCtx = ctx.getRelativeContext(it.next());
    State aState = (State) relativeCtx.getValue("..");
  
    // Do something with the State
}

No more *org.apache.commons.jxpath.JXPathException: Cannot compare 
pointers that do not belong to the same tree: '/.[2]' and '/.[1]'* 
exception.

Nicolas Laplante wrote:
> Tried with the expression you provided below, I got the same exception.
>


---------------------------------------------------------------------
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