commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John C Bledsoe <>
Subject [JXPath] Collection as Context
Date Fri, 10 Oct 2003 18:35:15 GMT

Does JXPath support any kind of Collection as a
Context?  I have had success with a Map but no success
with an ArrayList.

For example,

Given a list of Addresses, find all with a zip code of

// pseudo code
ArrayList list = new ArrayList();
list.add(new Address("90210"));
list.add(new Address("66213"));
list.add(new Address("90210"));
JXPathContext context =
Iterator iter = context.iterate("zipCode='90210'"); 
// returns one element of Boolean.FALSE
// many other XPath expression attempts omitted

I got it to work when the list is a bean property of
another class; e.g. "addresses[zipCode='90210']".

Also, is there any guarantee that a search will return
an ordered iterator if the expression is executed on a
Collection that guarantees order; i.e. LinkedList?


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message