From: Rodrigo C. <rn...@gm...> - 2007-02-28 18:40:44
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Mark, my implementation has some bug... it doesn't really work, but just let me know if the API is ok to you.<br> <br> We can iron-out bugs latter, with Jimmy help perhaps :-)<br> <br> You can create a SimpleContext, witch holds a position, with:<br> <br> SimpleContext ctx = new SimpleContext(null);<br> //starts as an empty context<br> <br> or<br> <br> SimpleContext ctx = new SimpleContext(int size);<br> // starts with given nodes capacity, so reallocation can be minimized during reuse<br> <br> and you can use the object to hold and retrieve positions with:<br> <br> navigator.setCtxFromNav(ctx);<br> //holds current position in this context object<br> <br> and<br> <br> navigator.setNavFromCtx(ctx);<br> //sets navigator pointers from this context object<br> <br> <br> The object itself has little storage requirements, only a small integer array, so you can create thousands and still live happy.<br> <br> They are also reusable, to minimize garbage collection just in case your algoritm wants to reuse them.<br> <br> Does this sound ok for you, Mark?<br> <br> <br> <br> Mark Swanson wrote: <blockquote cite="mid...@Sc..." type="cite"> <pre wrap="">Rodrigo Cunha wrote: </pre> <blockquote type="cite"> <pre wrap="">I understand NodeRecorder was not intended to be kept in large numbers, but I think that should exactly be the idea of a random access API: a lightweight way of keeping a bunch of bookmarks in the datastructure the programmer wants, not in the structure we want, or something... Your API is nice for somewhat serial processing, not for true random access, using pre-build hash tables, for example, or trees, or whatever. I could built a wrapper around NodeRecorder implementing a simplier API, but that would be really clumsy. My API, while incomplete, is much more simple, and flexible also... it's also rather light. I would like to learn about other opinions on the subject, since we are probably both too used to our way of doing things to be impartial. </pre> </blockquote> <pre wrap=""><!----> It would be most helpful to me if I could index arbitrary element indexes and start and XPath query from one of these indexes. I would cache these indexes in a Map with key: some unique ID, value: some sort of vtd-xml node index. For most of the applications I use XML for, this would be the only way to get acceptable performance. Ultimately, without this I would not be able to consider using vtd-xml for these apps and I would be forced to use an xml - Object mapping tool. I've been using and helping maintain/fix a number of XML - Object mapping tools over the years. It's been an interesting area of study for me. Please free me from the insufferable weight of those chains :-) Cheers. </pre> </blockquote> <br> </body> </html> |