commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <>
Subject Re: [JXPath] unordered node-sets
Date Mon, 17 Jan 2005 19:06:31 GMT

Perhaps my reading of the XPath specification is incorrect, but I understood 
it to say that node sets are in fact ordered.  The order of elements in the 
set is determined by the document order as well as the axis used (for 
example, "preceding::" will return nodes in the reverse document order). 
When I was first developing JXPath, I struggled with the issue of document 
order as it applies to the non-XML object models.  The best solution I could 
come up with was to impose some predictable order that makes sense.  Of 
course the first one that came to mind was the alphabetical order.  So, this 
is why property names of Java Beans are sorted by JXPath machinery.  That's 
the only sorting I can think of that goes on in JXPath.

As to your specific issue, I cannot really make any specific recommendations 
without seeing the code.  Would it be possible to post a code sample that 
illustrates the problem?

Thank you,

- Dmitri

----- Original Message ----- 
From: "Knut Wannheden" <>
To: <>
Sent: Friday, January 14, 2005 4:37 AM
Subject: [JXPath] unordered node-sets

> Dear JXPath users and developers,
> Some XPath expressions (e.g. "//foo" which uses the descendant axis), when
> applied to a Java object graph, can cause JXPath to traverse a vast number 
> of
> objects, which potentially takes a lot of time. This is what happens when
> hasNext() or next() is called on the Iterator returned by
> JXPathContext#iterate(String). Moreover, as the call to hasNext() or 
> next()
> seems to cause all matches to be pre-fetched and ordered (at least when 
> the
> expression starts with the descendant axis), the call appears to be 
> blocking.
> I was wondering if there is a way to iterate through the matched node-set 
> in a
> non-blocking manner. My understanding was that node-sets per definition 
> are
> unordered.
> TIA,
> --knut

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

View raw message