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" <[EMAIL PROTECTED]>
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  [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to