commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maomaode <maoma...@gmail.com>
Subject Re: JXPath nested property
Date Sat, 03 Feb 2007 11:06:11 GMT
Hi,

> Hi,
>
> I have the following 2 bean definitions:
>
> Country {
>    int id;
>    String name;
> }
>
> State {
>    int id;
>    String name;
>    Country country;
> }
>
> If I have a *List<State>*, how can I get every state that has a 
> *Country* having id = 2 ?
>
> I tried the following XPath expression using the *List<State>* as the 
> context:
> *
> //country[@id = 3]/.. *  (to fetch every state that have a *Country* 
> with id = 3)
Try XPath:  //country[id='3']
that said, try Iterator<State> it = (Iterator<State>) 
ctx.iterate("//country[id = ' + 3 + "']");


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