users@jaxb.java.net

Re: Marshal to DOM (using Node.userData)

From: Vivian Steller <vivi_at_eecoo.de>
Date: Sat, 15 Jan 2005 13:47:23 +0100

Am Freitag, 14. Januar 2005 17:10 schrieb Kohsuke Kawaguchi:
> Vivian Steller wrote:
> > is it possible to retrieve the original objects (meaning
> > the jaxb generated and unmarshalled with some xml file to
> > java objects) after marshalling it to DOM Nodes, maybe via
> > getUserData("someKey")??
>
> Not right now. But I think that's an interesting idea. And I think it is
> relatively easily doable.
>
> > My problem in general is, that i've a data-structure that
> > i want to display in a jtree (therefor dom is quite a nice
> > point to start writing some model-adapters) and
> > CONCURRENTLY in a jgraph (with anoter model, better to
> > adapt the original, jaxb genereated, classes). I want both
> > models beeing completly synchronously, thus i don't want
> > to generate a new model (by unmarshalling) each time one
> > of them changes to keep both up-to-date.
>
> But doing this requires much more than just a simple association,
> doesn't it. You somehow have to figure out a way to propagate changes
> from DOM to JAXB or JAXB to DOM without throwing away a whole tree, plus
> complete change notifications to update their respective views.
>
> I don't think maintaining two data structures in sync is the way you
> want to go. If I were you, I'd probably write a wrapper that provides
> typed access to DOM (you can make it generic by using
> java.lang.reflect.Proxy, for example) with change notifications.
This is the way I'm currently solving the problem... unfortunately by
hard-coding the "proxy" for each generated JAXB class (nearly 50) instead of
implementing a Dynamic Proxy, as far I'm new to java (just a little student
at the beginning;) and not familiar with Reflection in java and the Proxy
pattern.

>
> I've been thinking about something like that for some time now. Maybe I
> should try to implement that...
Would be very nice if you'll do that.. so please let me (us) know by answering
this thread...

Thanks very much for your help...
Best regards

Vivian Steller
University of Ulm, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net