[jdom-interest] JDOM w/ *long* streams

Daniel L. Rall dlr at finemaltcoding.com
Tue Aug 8 11:52:01 PDT 2000


Jason Hunter wrote:
> [snip]
> Hi dlr, small world.

Hi Jason.  :)

> > I am curious as to how well JDOM will handle the parsing of
> > records from
> > an extremely long data stream (10+ MB).  I would like to parse nodes
> > containing good sized DOM trees starting one level deep from the root
> > element.  Will JDOM need to read the entire stream before
> > giving access
> > to second level nodes
> 
> With our current builders, yes, because we use SAX to read the document
> and construct the JDOM tree based on the SAX events.  It's been a goal
> since the beginning to support a deferred builder, one that parses only
> what's necessary and stores offsets instead of data.  We'll probably use
> weak references so even already parsed data can be reclaimed as
> necessary, then rebuilt later if needed using the indexes.  That's not
> something I'm worrying about now though.  Gotta finalize 1.0 first.

Ahhhh, it's a thing of beauty...

> For what you want SAX may be the best option.  Or you could write a
> custom builder (and a custom Element subclass) that read the tree only
> as necessary.  Just implement lazy get methods that call for more
> parsing if they don't have the info they need.  It wouldn't be the
> special purpose deferred builder we envision, but it would be fairly
> easy to implement.

Okay, thanks!  The custom builder sounds very interesting...would
implementing that basically consist of slapping a DOMBuilder interface
over lazy SAX parsing?  Having a DOM or JDOM tree available would save
me *loads* of time.
-- 

Daniel Rall <dlr at finemaltcoding.com>



More information about the jdom-interest mailing list