users@jaxb.java.net

Re: SV: Re: SAX-like JAXB?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 19 Jun 2006 10:19:29 -0700

Henning Storhaug wrote:
>
> I managed to unmarshal transactions only based on the samples/partial-unmarshalling example.
> So I'm half-way there, only the difficult part left now.

Have you considered using StAX? That's much easier than the
partial-unmarshalling sample.

> If I could get the ContentHandler to support an interface like this:
>
> public interface UnmarshalListener {
> /**
> * report new object detected
> * @param object the new object occurrence
> */
>
> public void objectStart(Object object);
> /**
> * report object finished
> * @param object the finished object occurrence
> */
> public void objectEnd(Object object);
> }
>
> Then I can manipulate the graph as I go by caching whatever
> I need and clearing collections as they are populated.. btw,
> is schema validation handled during xml parsing or is it done based
> on the resulting object graph?

See
http://java.sun.com/javaee/5/docs/api/javax/xml/bind/Unmarshaller.Listener.html
for this.

I actually never thought of using it for partial unmarshalling, but I
think you just invented a very interesting approach to the problem.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com