Elliotte Rusty Harold <elh...@ibiblio.org> wrote on 04/20/2010 08:16:02 PM:
> On Tue, Apr 20, 2010 at 4:25 PM, Ramon F Herrera <ra...@patriot.net> wrote: > > > > Subtitle 1: How to make SAX fly. > > Subtitle 2: Should I use DOM instead? > > > > My application retrieves several items (attributes and text) from large XML > > files. Such items are used to create a spreadsheet. The app is based on > > JAXP, and the code contains many lines like these: > > > > cell.cellValue = oneItemAtATime(xmlFile, "//root/creator/@user"); > > cell.cellValue = oneItemAtATime(xmlFile, "//root/creator/@project"); > > cell.cellValue = oneItemAtATime(xmlFile, "//root/creator/@projectpath"); > > cell.cellValue = oneItemAtATime(xmlFile, "//root/creator/@title"); > > cell.cellValue = oneItemAtATime(xmlFile, "//root/creator/@notes"); > > cell.cellValue = oneItemAtATime(xmlFile, "//root/creator/@computer"); > > > > [...] > > I'm not sure what you're using, but nothing in this sample is SAX. It > sounds like there's some higher level API sitting on top of SAX doing > something ill-advised. Were you to rewrite this app to use real SAX, > you could first use a single pass to grab all the values you need; and > then fill the cells. And if the queries were complex enough that you couldn't stream it then you could build a DOM and evaluate each XPath over the same instance. You certainly don't need to parse the same document N times to accomplish this. > -- > Elliotte Rusty Harold > elh...@ibiblio.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org