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: Mike Colbert <mbcolbert AT yahoo.com>
  • To: John Cowan <cowan AT ccil.org>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM and Large Files
  • Date: Wed, 26 Jul 2006 08:43:20 -0700 (PDT)

--- John Cowan <cowan AT ccil.org> wrote:

> 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.
>

Thanks, John. Good catch, unfortunately in this specific case the files don't
have root elements, so I need to write in my own before I pass the contents to
XOM. (And I guess the moral of that story is don't keep XML in files without
root elements. It is what it is.)

Still, for future reference, I'm curious if any other options are available.

Mike






Archive powered by MHonArc 2.6.24.

Top of Page