users@jaxb.java.net

Re: 2nd try: Avoid both JAXB2 binding as well DOM creation for a document fragment?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 05 Jun 2007 16:33:43 -0700

Andreas Loew wrote:
> The performance gain I am striving for would only be coming from the
> fact that *no mapping or binding at all of the inner "xsd:any" fragment*
> would/should take place.

If you envision that the inner fragment be parsed, then the parsed
infoset needs to be stored in some form. There's certainly more
efficient infoset store than DOM, and the JAXB spec has pluggability
point to let you use more efficient data store (perhaps
http://xmlstreambuffer.dev.java.net/)

If you envision that the inner fragment to be left unparsed (in which
case none of the data after the fragment is available), you could
conceivably data-bind some head portion and then use StAX API or
something to lazily access the latter.

JAXB doesn't provide such capability out of the box, but you can kind of
make it work by writing an XMLStreamReader wrapper that only feeds the
head portion to JAXB and keep the rest untouched.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com