commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <>
Subject JXPath, beans and the count function
Date Thu, 27 Jul 2006 17:47:05 GMT
Hi there,
we are developing paginated repeater for Cocoon. The cocoon repeaters
uses JXPath in their binding so that they can work on beans and XML

The goal for us is to display a very long list of elements from a
collection not fetching the entire content of the collection. This is
expecially useful when the collection is backed by a persistence layer
like hibernate or similar, and you have a very big rowset (we are
testing on an application with a list with 11000 elements in it).

Now, one key element for every pagination system is to retrieve the
total amount of items in the list. We tried to accomplish this with a
count(pathToList). Actually we have a bean having a getList method
returning a java.util.List instance, so we try count(list/*) ,
count(list), count(list/something), and we would expect JXPath to call
getList().size(). This is quite critical, because the list
implementation knows how to retrieve the number of rows without actually
fetching all the rows from the underlying dataset.

Unfortunately, what hapens is different. The
CoreFunction.functionCount() method does not recognize it as a
Collection, but as a EvalContext instead, and iterates on all the lines
to count the items (actually is the EvalContext.hasNext() method that
iterates on the entire collection).

What's strange is that there is a check in CoreFunction.functionCount()
to see if a Collection is in place and eventually call the
Collection.size() method, but this seems like it's never happening.

Could you please help us? Is it a JXPath bug or are we completely
missing something?

TIA, regards,
Simone Gianni,
Matthias Epheser

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

View raw message