[jdom-interest] JDOM and very large files
Todd O'Bryan
toddobryan at mac.com
Fri Oct 10 02:18:03 PDT 2003
When I had to parse sections of a large file, I wrote a utility class
that would load the next element of the kind I was concerned with. For
instance, if the document was of the form
<foo>
<bar>
lots of stuff
</bar>
<bar>
lots of stuff
</bar>
<bar>
lots of stuff
</bar>
</foo>
I subclassed a Reader that would return the next <bar> element and used
JDOM to parse and manipulate it. If your document is less
straightforward, that might not be possible, but recall that the point
of JDOM is that you get the whole XML tree in memory to manipulate and
play with at once. If you don't want that, you have to decide which
parts to leave out.
Todd
On Friday, October 10, 2003, at 01:07 AM, Daryl Handley wrote:
> Hi everyone,
>
> I am trying to parse a very large file (1.3 Gb) using JDOM. I have
> used JDOM
> before with smaller files, but never large ones. It seems like the
> builder
> attempts to read the whole file into memory and build the document. Is
> there
> a way to read only part of the document into memory ? I only beed to
> read
> through the file sequentially, random access to parts of the doc is not
> important. Does anyone have any suggestions how to do this with JDOM ?
> Java
> in general ? Any other language ?
>
> Otherwise I may have to write my own parser to do it in PERL. The
> document
> structure is fairly simple (just huge) so this shouldn't be too hard,
> but I
> would prefer to do it with JDOM if possible.
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/
> youraddr at yourhost.com
More information about the jdom-interest
mailing list