commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wannheden, Knut" <knut.wannhe...@paranor.ch>
Subject [jxpath] JXPathContext#iterate(String) returns same object multip le times
Date Thu, 05 Jun 2003 09:47:05 GMT
Hi all,

I just noted that both the methods JXPathContext#iterate(String) and
JXPathContext#iteratePointers(String) can return the same object multiple
times if the path (or pointer) to it is different.

In my object graph I have some two-way associations which can cause this
behaviour and that's of course not desirable.  In this scenario
iteratePointers("//b") can end up returning something like:

	/a[1]/b[1]
	/a[1]/b[1]/a/b[1]
	/a[1]/b[1]/a/[b[1]/a/b[1]
	...

The two-way associations I have are actually containments comparable to
XML's parent-child relationship between elements.  How can I extend JXPath
to specify what properties in my model are parent relationships?

But regardless of these parent-child relationships I think it's questionable
whether the same object should ever be returned twice by these iterators.
Because it means that the iteration can turn out to be never-ending.  Or
will it even always be indefinite?  But I've probably missed an important
aspect here :-)

--
knut

Mime
View raw message