|
From: Mark S. <ma...@Sc...> - 2006-12-05 05:42:11
|
>> I do have a concern/question: what is the overhead of XPath parsing in >> these cases vs coding the queries in Java using the VTDNav class? I >> think I remember you posting before that the overhead was negligible, >> but I wasn't sure in what context or what circumstances this was the >> case. >> > > XPath parsing is usually not a big overhead... > XPath evaluation performance depends on the complexity of the XPath > expression ... simple one (e.g. /*/*/* ) is pretty fast, complex ones, > (//*) > takes longer, it also has to do with the context of XPath eval. For > relative > Xpath, if the evaluation only iterates over the entire DOM tree, it will > take longer > than only evaluting it over a smaller sub tree... > this applies to DOM as well as VTD-XML ... Ok, so XPath parsing is fast. I'll just accept that :-) Good to know the eval is smart enough to just walk sub trees. >> If you have any additional comments in this regard I'd appreciate >> reading them. In particular, if you had any performance tips using the >> XPath evaluator that would be great. >> > > We will update some of the articles on the website, also there is going > to be > an article for Javaworld in which XML MOdifier will be disucssed... Looking forward to it. >> Also, I have just found out about XMLModifier. Do you have any example >> code that shows how best to use this class? Not that it looks difficult >> - I'm just incredibly lazy and just want to copy/paste code that sets up >> the VTDNav and calls bind() appropriately. :-) >> > In the example code there is a directory named "update," in which you > will find > the example code of using XML Modifier Ah, thanks. >> I couldn't find a way to create a masterDocument with a specific >> character set or other prologue data...(mainly so I can just use >> updateToken(int, String) ). >> > > masterDocument is really an instance of VTDNav... the way to create one > is to parse an XML document... > > Did I understand this part of your question? I don't think so. Here is an example of what I want to do: I want to use VTD-XML to create an in-memory representation of a document, and then serialize it to a byte[]. What you seem to be saying is that I need to boot-strap this by creating an empty XML document, parse it, and them use XMLModifier to dynamically create the document before serializing it to byte[]. This is important to me for using VTD-XML for tasks other than just routing XML requests. I need to create and modify XML responses as well... Note: The output prologue is very important. I'd like the ability to just create an empty VTDNav, and specify the prologue info (version and encoding attributes are the most important to me). >> It would also be interesting to see how well XMLModifier benchmarks >> against xerces. > > The bechmark number combines XPath, paring and outputting. Outputting > alone will be make the number look even better... Fantastic. Cheers. -- http://www.ScheduleWorld.com/ Free Google Calendar synchronization with Outlook, Evolution, cell phones, BlackBerry, PalmOS, Exchange, Mozilla, Thunderbird, Pocket PC/Windows Mobile. Also sync tasks, notes and contacts! WebDAV, vfreebusy, RSS, LDAP, iCalendar, iTIP, iMIP support. |