--- Warren Liang <[EMAIL PROTECTED]> wrote: > Thanks Matt for your response :). > > I believe that JXPath is working the way that it's > supposed to in > regards to what I'm doing. > > I think I'm going to try out a > DynamicPropertyHandler that will return > a list of no properties if I'm encountering an > object that I've > already encountered before. I'm guessing that this > will require me to > create a Set that will keep track of all of the > nodes that I've > already encountered. > > Hopefully, I'll be able to implement a breadth first > search by > customizing NodeIterator (I hope that's the right > hook). >
If you come up with anything interesting, feel free to post it on the Wiki. br, Matt > Thanks, > > Warren > > On Jan 25, 2008 9:50 AM, Matt Benson > <[EMAIL PROTECTED]> wrote: > > > > --- Warren Liang <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > > > > How does JXPath handle circular object paths? > My > > > object graph is can > > > have circular references to objects that are the > > > same instance (i.e. > > > obj1 == obj2), or are different instances but > have > > > equivalent values > > > (i.e. obj1.equals(obj2)) > > > > > > Right now, I'm evaluating JXPath expressions > that do > > > not match > > > anything in the object graph and it seems like > it's > > > going through an > > > infinite loop. Some of my expressions use the > > > "match anywhere" > > > operator (i.e. //). > > > > If you are encountering behavior that feels wrong > to > > you, feel welcome to open an issue in JIRA, > preferably > > with some sample code that can easily be turned > into a > > standalone JUnit test. > > > > > > > > Does JXPath use a breadth first search or a > depth > > > first search through > > > the object graph? > > > > > > > In my experience, not being the original author of > the > > code, JXPath determines matching nodes for a given > > level, then applies subsequent levels in > > recursive-descent fashion to each node selected at > the > > current level. So given: > > > > <a> > > <b> > > <c /><c /> > > </b> > > <b> > > <c /><c /> > > </b> > > <b> > > <c /><c /> > > </b> > > </a> > > > > and path "/a/b/c", JXPath will determine that a[1] > > matches the first step and apply the next step. > Now > > it determines that a[1]/b[1], a[1]/b[2] and > a[1]/b[3] > > match the second step. Then it applies the third > step > > to a[1]/b[1], a[1]/b[2], and a[1]/b[3] in > succession. > > I interpret this as being depth first. > > > > > Ideally, I'd be able to tell JXPath to recurse a > > > maximum depth, or to > > > recognize that a node has already been traversed > > > Are there hooks for > > > me to do this? > > > > > > > I suppose nothing would ever stop you from > > implementing a custom "I haven't seen this before" > > function to guard each step, but it might get a > little > > heavy at RT depending on the size of your graph. > Off > > the top of my head I can't remember what, if any, > > safeguards are built into JXPath to prevent > infinite > > recursion, hence my initial suggestion (and > attempt to > > put the onus onto you ;) ) that you submit reports > for > > problems encountered. > > > > Is any of this helpful whatsoever? > > -Matt > > > > > Thanks, > > > > > > Warren Liang > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > ____________________________________________________________________________________ > > Never miss a thing. Make Yahoo your home page. > > http://www.yahoo.com/r/hs > > > > > --------------------------------------------------------------------- > > 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] > > ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
