A Java Object Graph can easily be converted to a XML tree with proper use
of 'cross-referencing' attributes. What I would like to know from you is,
if I could use "safely" the Employee class (i.e your serializer would not
run out of Stack Depth).
>From my experience of using JAXB, I know that SUN implementors of JAXB have
taken a very conservative approach with respect to graph cycles. The
approach
is described as follows:
* If during serialization, any object reference is encountered twice, a
CycleException
will be thrown.
This has practical limitation on SUN JAXB use. For example, I was writing 10
XML records
to a file from my Java JAXB program. A certain part of these 10 records was
same. I tried to reuse
a Java object for the "same part" 10 times. DID NOT WORK. I had to use 10
DIFFERENT JAVA OBJECTS
CARRYING SAME DATA. COULD NOT REUSE JAVA OBJECT IN JAXB.
So, my suggesstion would be that you please concentrate on the use case
(Employee) I mentioned
rather than pondering whether JAXB supports it or not. Ultimately your
serializer needs to
support valid 'serializer use cases' regardless of technical limitations of
JAXB.
Regards,
Soumen Sarkar.
-----Original Message-----
From: Radek Wisniewski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 1:16 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Serializer for JAXB
My serializer is very simple and relies on abylities from JAXB.
I think, at this stage of developing, JAXB doesnt care of any "graph"
issues, serialisation by JAXB is designed for XML documents they are
usually trees not graphs, and JAXB instances, they are "tree formed" so
they are right serialized and deserialized.
Radek Wisniewski
On Tue, 14 Aug 2001, Soumen Sarkar wrote:
> Does it take care of cycles in object graph to be serialized. Apache SOAP
> serializer
> does not. It runs out of stack. Please consider the following java object:
>
> class Employee
> {
> Employee[] subordinates;
> Employee manager;
> }
>
> It is easy to have cycles in such data structures(not a bad design or
> illegal thing to do).
> Will your serializer take care of flattening the object graph with cycles?
> JAVA RMI serialization takes care of serializing any arbitrary object
graph
> to a linear serialized stream keeping all graph semantics intact.
>
> Regards,
> Soumen Sarkar.
>
> -----Original Message-----
> From: Glen Daniels [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 14, 2001 9:40 AM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: RE: Serializer for JAXB
>
>
>
> I'd love to see it. Would you be willing to post it to the list?
>
> > -----Original Message-----
> > From: Radek Wisniewski [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 14, 2001 12:09 PM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: Serializer for JAXB
> >
> >
> > I'v written one, works.
> > I have'n tested to much but i hope its good.
> >
> > Is anybody interested in?
> >
> >
> > Radek Wisniewski
> >
>