Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 81554 invoked from network); 10 Oct 2003 19:53:22 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 10 Oct 2003 19:53:22 -0000 Received: (qmail 41062 invoked by uid 500); 10 Oct 2003 19:53:07 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 41053 invoked by uid 500); 10 Oct 2003 19:53:07 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 70545 invoked from network); 10 Oct 2003 18:35:10 -0000 Message-ID: <20031010183515.90739.qmail@web41502.mail.yahoo.com> Date: Fri, 10 Oct 2003 11:35:15 -0700 (PDT) From: John C Bledsoe Subject: [JXPath] Collection as Context To: commons-user@jakarta.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello, 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 90210. // pseudo code ArrayList list = new ArrayList(); list.add(new Address("90210")); list.add(new Address("66213")); list.add(new Address("90210")); JXPathContext context = JXPathContext.newContext(list); 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? John __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org