users@jaxb.java.net

Re: JAXB marshalling recurzive object strucutre

From: Malachi de Ælfweald <malachid_at_gmail.com>
Date: Wed, 2 Aug 2006 08:47:22 -0700

Generally, when you realize that your schema could go in a loop like that,
it is a good time to re-evaluate whether that is really the correct format.

For example, when working on genealogy information, I run into a similar
situation. So, instead of trying to put all a person's data into a single
XML file, I would put them in seperate files and use IDs and REFs. Then,
recursion never happens, though via the API you could load it as such (ie:
load via ID, get a child tag and load it via ID)....

Just my 2 cents.


Malachi

On 8/2/06, Csík Norbert <norbert.csik_at_gmail.com> wrote:
>
> Hi,
>
> Well, I can do my xsd as described, and I can marshall it like here:
>
> <pers>
> <name>Joe</name>
> <firm>
> <name>ACME</name>
> <directorPerson>
> <name>Sam</name>
> <!-- no firm -->
> </directorPerson>
> </firm>
> </pers>
>
> My problem is that what if Sam's firm is ACME. Then the marshalling
> can get into an infinity loop. If I'm right, how can I achive it
> doesn't happen? Eg. stop the marshalling process if it processes the
> same object.
>
> Thanks,
>
> On 8/2/06, Dmitri Colebatch <dim_at_colebatch.com> wrote:
> > Hi Csik,
> >
> > Sorry - my apologies, I completely missed the recusive reference. I
> > don't believe there are any samples that cover it. Having said that I
> > do have some recollection of seeing similar discussions in the past.
> > I suppose the real question is what would you want it marshalled into?
> >
> > cheers
> > dim
> >
> > On 8/2/06, Csík Norbert <norbert.csik_at_gmail.com> wrote:
> > > I'm sorry, maybe I'm doing something wrong, but I can't find a related
> > > example. Can you help me what did you mean?
> > >
> > > Thanks,
> > >
> > > On 8/1/06, Dmitri Colebatch <dim_at_colebatch.com> wrote:
> > > > Hi,
> > > >
> > > > Yes JAXB can marshall that - please have a look at the samples
> > > > provided before asking such a question.
> > > >
> > > > dim.
> > > >
> > > > On 8/1/06, Csík Norbert <norbert.csik_at_gmail.com> wrote:
> > > > > Hi!
> > > > >
> > > > > Can JAXB marshall an the following object structure, and if so
> then how?
> > > > >
> > > > > pers1.name = "John"
> > > > > pers1.firm = firm1
> > > > >
> > > > > firm1.name = "ACME"
> > > > > firm1.directorPerson = pers1
> > > > >
> > > > > marshal(pers1)
> > > > >
> > > > > Thanks,
> > > > >
> > > > > --
> > > > > Norbert Csík
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > > > > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> > > > >
> > > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > > > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> > > >
> > > >
> > >
> > >
> > > --
> > > Norbert Csík
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
>
>
> --
> Norbert Csík
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>