users@jaxb.java.net

Re: Discard some xml elements when unmarshalling

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 22 Dec 2004 09:51:34 -0800

domakmail-informatique_at_yahoo.fr wrote:
> Hi,
>
> I have a big xml document and I want to reduce the memory consumption when I
> unmarshall it in java objects using JAXB. A lot of xml elements of this document
> are not useful for my process: the xml file is an input file that I want extract
> informations to insert then in a database.
>
> How can I provide a custom binding to not bind xml elements (simple and complex)
> to java properties? I want the unmarshaller to discard them.

The most performant way to do this is to write a SAX XMLFilter. You can
selectively hide some elements from XML in this filter, then you can set
up a pipeline as:

        parser -> your filter -> JAXB unmarshaller

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net