users@jaxb.java.net

RE: RE: Avoid both JAXB2 binding as well DOM creation for a document fragment?

From: Ernst, Matthias <matthias.ernst_at_coremedia.com>
Date: Thu, 24 May 2007 10:47:28 +0200

Andreas,

I did send a reply through jaxb-users.

Cheers
Matthias

-- 
matthias.ernst_at_coremedia.com
software architect
+49.40.32 55 87.503 
> -----Original Message-----
> From: Ernst, Matthias [mailto:matthias.ernst_at_coremedia.com] 
> Sent: Monday, May 21, 2007 5:20 PM
> To: users_at_jaxb.dev.java.net
> Subject: RE: Avoid both JAXB2 binding as well DOM creation 
> for a document fragment?
> 
> Andreas,
> 
> I don't think this is possible right now. Internally, JAXB is 
> push-based (stream reader is immediately
> bridged onto a push API), so direct access to the 
> StreamReader would be hard. The only possible
> implementation I could imagine that wouldn't require a whole 
> lot of work is to get JAXB (through a new
> implementation of the Loader class) to push events into a 
> user-provided SAX ContentHandler, a la
> 
> Wrapper {
>   @XmlAttribute
>   public String attribute;
> 
>   @XmlElement
>   public MyHandler body;
> }
> 
> where while unmarshalling, if MyHandler implements SaxResult, 
> JAXB would push SAX events into it.
> Access to the surrounding context and handler implementation 
> could be established through an Unmarshaller.Listener.
> 
> Likewise, if MyHandler implements SaxSource, JAXB could use 
> it while marshalling.
> 
> Highly handwavy, and certainly not without changes to JAXB.
> 
> 
> Cheers
> Matthias
> 
> -- 
> matthias.ernst_at_coremedia.com
> software architect
> +49.40.32 55 87.503
> 
> CoreMedia AG
> Executive Board: Sören Stamer (CEO), Dr. Klemens Kleiminger (CFO)
> Supervisory Board: Prof. Dr. Joachim Schmidt (Chairman)
> Trade Register: Amtsgericht Hamburg, HR B 76277