From: Rodrigo C. <rn...@gm...> - 2007-02-27 18:43:40
|
Hi Jimmy! I've tested the new random access API... it doesn't quite work the way I expected, for example: AutoPilot ap = new AutoPilot(vn); ap.bind(vn); ap.selectElement("ServiceID"); NodeRecorder myContext = new NodeRecorder(vn); while(ap.iterate()){ myContext.record(); // do something messy myContext.resetPointer(); } resetPointer also affects ap context precluding it from correctly cycling the values. Why don't you just export something similar to what is kept in the stack anyway? A context is so simple, you just need an efficient byte array... When you ask for context repositioning you just have to overwrite the values in "vn", no need for anything more. A context is (should be) the equivalent to a stack position, nothing more... I think I sent you my altered ximpleware_1.6, do you want the code to look again? This is a simple context: /** * This class is used to store a single context of VTDNav class. */ public class SimpleContext{ private int[] buf; private int bufsize = 0; public SimpleContext(int[] in) { // This allows both allocation during creation and allocating // an adequate buffer size so that no further reallocation is // needed in the future. if (in != null) { buf = in.clone(); bufsize = in.length; } else { buf = new int[0]; bufsize = 0; } } public void set(int[] in) { if (buf.length < in.length) { buf = in.clone(); } else { System.arraycopy(in,0,buf,0,in.length); bufsize = in.length; } } public boolean get(int[] out) { if (bufsize > 0) { if (out.length != buf.length) { out = buf.clone(); } else { System.arraycopy(buf,0,out,0,bufsize); } return true; } else { return false; } } } Jimmy Zhang wrote: > The latest benchmark reports (on Version 2.0) is now live > at > http://vtd-xml.sf.net/benchmark1.html > > The corresponding benchmark code also was uploaded > to the sourceforge at > > http://sourceforge.net/project/showfiles.php?group_id=110612 > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Vtd-xml-users mailing list > Vtd...@li... > https://lists.sourceforge.net/lists/listinfo/vtd-xml-users > > |