You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Michael Glavassevich <mr...@ca.ibm.com> on 2010/04/21 02:43:48 UTC

Re: Question about performance for COM/SAX gurus

Elliotte Rusty Harold <el...@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
> elharo@ibiblio.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org