users@jaxb.java.net

AW: Re: SAX-like JAXB?

From: Ernst, Matthias <matthias.ernst_at_coremedia.com>
Date: Tue, 29 Aug 2006 11:10:42 +0200

> Would you be interested in turning something like that into a
> complete example that we can ship?

Kohsuke,

I've created a new sample "streaming-unmarshal" out of the
partial-unmarshal sample.

I had first hoped that I would not need to modify the generated classes
but there is no setter for the PurchaseOrder list. Having to modify
PurchaseOrders anyway, I created a small listener interface that is
bridged to List#add.

> The other thing you might find useful for this is per-class
> listener method.

I find I still need to use the Unmarshaller.Listener since I typically
need access to an object from "outside" within the notification handler.
This sample only uses System.out.println but in reality I would want to
store the PO in a database, so I need access to the datasource in the
listener. That is not possible using the per-class listener methods
unless they reach out and read a static/thread-local/JNDI. It think it
is better to inject instead.

Matthias
-- 
Matthias Ernst
Software Engineer
 
tel +49.40.32 55 87.503
fax +49.40.32 55 87.999
matthias.ernst_at_coremedia.com