users@jaxb.java.net

AW: Processing Large XML Files

From: Wiedmann, Jochen <jochen.wiedmann_at_softwareag.com>
Date: Sat, 1 Nov 2003 11:54:58 +0100

> I'm trying to find the best solution to progressing a very large XML file.
> This XML file is filled with independent elements which i want to
unmarshall
> one at a time because of memory constraints (the file is about 60GB).

> <BIND-Interaction-Set>
> <BIND-Interaction>
> ...
> </BIND-Interaction>
> ....
> ....
> </BIND-Interaction-Set>

In your schema, specify both BIND-Interaction-Set and BIND-Interaction as
top-level-elements. The generated classes will be able to unmarshal
BIND-Interaction elements.

Next, create a filtering SAX handler, which instantiates an
UmarshallerHandler upon any startElement for BIND-Interaction. All SAX
events (including a startDocument() and the original startElement() must be
delegated to the UnmarshallerHandler, as long as an endElement for
BIND-Interaction appears. An additional DOM tree is not required and in fact
a serious performance leak.


Jochen