users@jaxb.java.net

Unmarshal a sax stream in parts

From: Nick Stolwijk <nick.stolwijk_at_gmail.com>
Date: Tue, 22 Mar 2011 11:37:55 +0100

Hi,

I was wondering if it was possible to unmarshal a sax stream into
objects one by one. We have a large xml message and we want to process
each part as a Java object.

i.e.

<message>
   <message-part <--! the message part --> />
   <message-part <--! the message part --> />
<message>

And we want each message-part as a MessagePart object but not at the same time.

So,
(Pseudocode)
while (saxStream ! empty) {
   MessagePart part = unmarshaller.unmarshall(?);
   process(part);
}

Can someone tell me if this is possible and point me in the right direction?

With regards,

Nick Stolwijk
~Senior Java Developer~

iPROFS
Wagenweg 208
2012 NM Haarlem
T +31 23 547 6369
F +31 23 547 6370
I www.iprofs.nl