From: Jimmy Z. <cra...@co...> - 2006-08-22 20:14:03
|
----- Original Message ----- From: "Jimmy Zhang" <jz...@xi...> To: "Walinsky, Frank" <fwa...@ex...> Cc: <vtd...@li...> Sent: Tuesday, August 22, 2006 12:57 PM Subject: Re: push and pop > It may be a case-specific hack for you... > AutoPilot internally *remembers* a few variables (string name, depth etc), > to capture/restore, there may be additional data structure (e.g. a stack) > needed to store those variables... > > but my questions is how you really do anything different from using DOM > you will still have to instantiate nodeIterators for each levels right? > > also vtd...@li... seems to be working now > > > ----- Original Message ----- > From: "Walinsky, Frank" <fwa...@ex...> > To: "Jimmy Zhang" <jz...@xi...> > Sent: Tuesday, August 22, 2006 11:46 AM > Subject: RE: push and pop > > > What might be needed is a capture/restore of the AutoPilot along with > the currentoffset > > -----Original Message----- > From: Jimmy Zhang [mailto:jz...@xi...] Sent: Tuesday, August 22, > 2006 11:19 AM > To: Walinsky, Frank > Subject: Re: push and pop > > I need to think about this... > ----- Original Message ----- > From: "Walinsky, Frank" <fwa...@ex...> > To: <jz...@xi...> > Sent: Tuesday, August 22, 2006 4:13 AM > Subject: RE: push and pop > > > I will try another approach using just 1 AutoPilot by trying to rework > my current code. > > -----Original Message----- > From: jz...@xi... [mailto:jz...@xi...] Sent: Monday, > August 21, 2006 10:18 PM > To: Walinsky, Frank > Subject: Re: push and pop > > Can you kinda explain why allocating multiple AutoPilots is > show-stopping?? > because autoPilot allocation is fairly light weight? Maybe VTD-XML can > custom build something for your case... > > Walinsky, Frank writes: >> Jimmy, >> I did try 3 different AutoPilots after I sent this and that does work >> just as you thought it would. >> It also works without doing any push or pop. >> My situation has a user generated state which could have an unlimited >> amount of nesting. >> This state is processed by some generic code, which is not custom >> generated but used by all user generated states. >> This works fine with the DOM product I'm using. >> I was looking to reduce the memory footprint and do a proof of concept >> with your app for management. >> If I can't use the one AutoPilot with push and pop, I'm dead in the >> water with your app right out of the gate. >> If you could take a closer look, when you have time, and see if it is > a >> bug or just not possible, I would greatly appreciate it. >> Thx for all your help, >> Frank >> ________________________________ From: Jimmy Zhang >> [mailto:jz...@xi...] Sent: Monday, August 21, 2006 4:13 PM >> To: Walinsky, Frank; vtd...@li... >> Subject: Re: push and pop Frank, upon a quick look, I feel you might want >> to instantiate three >> autoPilot >> objects, the first one you set the element name "a," the second set > the >> element >> name "b," and the last one set the element "c." Could >> Cheers, >> Jimmy Zhang ----- Original Message ----- >> From: Walinsky, Frank <mailto:fwa...@ex...> To: >> in...@xi... Sent: Monday, August 21, 2006 12:40 PM >> Subject: push and pop Jim, >> I apologize again for using this address but it has become >> completely frustrrating trying to send to the list. >> I just tried a handfull of times and had my message returned. I >> did get one through this morning so I know it does work >> but when is anybodies guess. >> >> Could you please look at this when you have time? >> >> >> >> Is it possible and if so, is there any sample code somewhere >> that does the following: >> (I ask because I haven't found a way or I'm probably using the >> api incorrectly) >> >> I'm trying to use the same AutoPilot object in a 3 level nesting >> using a VTDNav "push" >> before entering the next lower level and the VTDNav "pop" before >> returning to the previous higher level. >> Neither the "iterate" or an "evalXPath" advance to the next >> element after the pop. >> >> Here's a sample xml I'm using: >> <?xml version=\"1.0\" encoding=\"UTF-8\"?> >> <root> >> <a> >> <b> >> <c>this is abc_11</c> >> <c>this is abc_12</c> >> <c>this is abc_13</c> >> <c>this is abc_14</c> >> </b> >> <b> >> <c>this is abc_21</c> >> <c>this is abc_22</c> >> <c>this is abc_23</c> >> <c>this is abc_24</c> >> </b> >> </a> >> <a> >> <b> >> <c>this is second abc_31</c> >> </b> >> </a> >> </root> >> >> >> Here's a snippet of my code. >> >> vn.toElement(VTDNav.ROOT); >> >> ap.selectElement("a"); >> while (ap.iterate()) { >> System.out.println("--- before push() of \"a\"---"); >> vn.dumpContext(); >> vn.push(); >> System.out.println("a = " + vn.getCurrentIndex()); >> >> ap.selectElement("b"); >> while (ap.iterate()) { >> System.out.println("--- before push() of \"b\" ---"); >> vn.dumpContext(); >> vn.push(); >> System.out.println("b = " + vn.getCurrentIndex()); >> >> ap.selectElement("c"); >> while (ap.iterate()) { >> System.out.println("c = " + vn.getCurrentIndex()); >> } >> >> vn.pop(); >> System.out.println("--- after pop() of \"b\" ---"); >> vn.dumpContext(); >> } >> >> vn.pop(); >> System.out.println("--- after pop() of \"a\" ---"); >> vn.dumpContext(); >> } >> > > > > > > > > |