From: Rodrigo C. <rn...@gm...> - 2007-03-01 03:20:56
|
Nah... given what i understand about the internal structure making it the new document root is not trivial, i think. But you could get away with: - A bookmark/position saving system, aka the (in)famous SimpleContext class?... - A function evaluating: boolean SimpleContext.isSunOf(Simplecontext ctx); //this should be simple and efficient to implement Regards, Rodrigo Mark Swanson wrote: > Rodrigo Cunha wrote: >> For a SimpleContext, or something similar: >> >> The comparison operator could just compare the arrays containing the >> internal state of Navigator. >> >> The hashcode would be the XOR of all elements in the array, that >> implements java hashcode and equals in a compatible way with the >> assumed rules in java libraries. >> >> Jimmy, I think my "SimpleContext" or whatever you want to call it, if >> properly implemented and perhaps with a few extra functions could >> solve all the problems of random access. >> >> I think we just want something with the functionality of push() and >> pop() but that can be extracted and kept outside, memorizing the >> equivalent of a single stack position, and perhaps with a bit more >> functionality. > > It will be interesting to see how much / little info we can get away > with saving and still be able to start an XPath expression from an > arbitrary point. > > Important: it may make the implementation easier if we make the > arbitrary starting point the new document root - just for xpath > evaluation purposes. I think this is perfect, actually. I don't want > anything except for the node and its children - that's why I'm > explicitly pointing there in the first place. > > F.E. > (forgive the illegal simplified syntax..) > > aaa > bbb > ccc <- Index saved, new root for xpath eval. > eee > fff > /ccc > dd > ... > > I'd want to say something like this: > > vtdNav.toElement(cccIndex); // reset cursor to ccc > ap.selectXPath("/ccc/*") > > Cheers. > |