users@jaxb.java.net

Re: Mixing custom/manual marshalling with JAXB

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 11 Jul 2006 18:04:17 -0700

Nick Minutello wrote:
> I can give it a try.
>
> I am just mindful of the performance impact of that.
> The major part of the payload I will be marshalling/unmarshalling will
> be the dynamic stuff.
>
> Ideally it would be nice to plug in a handler for a given class - and
> that handler would have the marshalling/unmarshalling delegated to it.

 From JAXB implementation point of view, it's hard to come up with an
XML infoset API that can be used for hand-off to user-defined handler in
your scheme, even though the idea of "custom marshalling" is certainly
appealing.

StAX doesn't work for unmarshalling because unmarshalling is allowed
with SAX. So it just so happens that DOM is the simplest way.

Dmitri's approach makes a stronger assumption (namely you need to have
classes like "Cat" in his example), but if that works, that's better for
you wrt performance.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com