commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <dmi...@apache.org>
Subject Re: JXPath cycles
Date Wed, 04 May 2005 22:23:24 GMT
Elliotte,

While traversing the graph of model objects, JXPath maintains a trace of 
nodes it's visited.  If it encouters a node that has already been visited, 
it simply skips it.  That's how it avoids the infinite loop in a situation 
like the one you are describing.

I hope this helps,

- Dmitri

----- Original Message ----- 
From: "Elliotte Harold" <elharo@metalab.unc.edu>
To: <commons-dev@jakarta.apache.org>
Sent: Wednesday, May 04, 2005 9:05 AM
Subject: JXPath cycles


> How does Commons JXPath handle cycles when querying JavaBeans? For 
> instance suppose bean A has a property X whose value is a reference to 
> bean B. Suppose also bean B has a property Y whose value is a reference to 
> bean A. Then suppose, starting with bean A as the context node, we make 
> the query .//*. What happens and why? Is it an infinite loop?
>
> This is a simple case, but clearly the cycle could be longer than length 
> 2.
>
> -- 
> Elliotte Rusty Harold  elharo@metalab.unc.edu
> XML in a Nutshell 3rd Edition Just Published!
> http://www.cafeconleche.org/books/xian3/
> http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message