On Mon, May 16, 2011 at 4:51 AM, Romain Rouvoy <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
