Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM and Large Files

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <cowan AT ccil.org>
  • To: Mike Colbert <mbcolbert AT yahoo.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM and Large Files
  • Date: Wed, 26 Jul 2006 11:07:21 -0400

Mike Colbert scripsit:

> Right now, I'm just using an InputStreamReader on a FileInputStream
> to read the file contents into a String and then using Builder.build
> (StringReader) to create the XOM object, then traversing it
> sequentially.

You should probably pass the FileInputStream directly to XOM, and
it's well worth wrapping it in a BufferedInputStream before you do
that. Reading it into a String just makes a single large object
in memory that you can well do without.

If you don't need to process the whole file at once, using a
NodeFactory as Wolfgang suggests is also a pretty good idea.

--
What is the sound of Perl? Is it not the John Cowan
sound of a [Ww]all that people have stopped cowan AT ccil.org
banging their head against? --Larry http://www.ccil.org/~cowan




Archive powered by MHonArc 2.6.24.

Top of Page