commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: [jxpath] Navigating across Lists
Date Mon, 16 May 2011 14:06:25 GMT
On Mon, May 16, 2011 at 4:51 AM, Romain Rouvoy <romain.rouvoy@lifl.fr> wrote:
> Hi,
>
> I'm using JXPath to query a graph of beans, which are heavily using lists, e.g.:
>> public class A {
>>       List<B> getB() {...}
>> }
>>
>> public class B {
>>       String getName() {...}
>>       List<C> getC() {...}
>> }
>>
>> public class C {
>>       String getName() {...}
>> }
>
> However, when I'm querying this graph of beans, the following request does not match
any elements (while it should return several elements):
>> org.apache.commons.jxpath.JXPathContext.newContext(new A());
>> context.getValue("b[@name='foo']/c/name");
>
> Any idea? Does JXPath support navigation within lists?
>

What should happen is that getValue(expr) returns the first value
specified by your expression, while iterate(expr) would be the way you
would retrieve multiple results.  If you can distill your problem down
to a failing JUnit test, please feel free to attach this to a JIRA
issue.

Matt

> Thanks for you help,
> Romain
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message