Thanks, that makes sense.

On Fri, Jul 6, 2012 at 6:49 PM, Jörg Schaible <[email protected]> wrote:

> Hi Eugen,
>
> Eugen Paraschiv wrote:
>
> > Hi,
> > I'm running into a strange problem with my XML output; I'm using XStream
> > 1.4.2 (and Spring).
> > I'm marshalling a List of Role:
> > @XmlRootElement
> > @XStreamAlias( "role" )
> > public class Role{
> >     @XStreamImplicit
> >     private Set< Privilege > privileges;
> >    ...
> > }
> > the Privilege is even simpler:
> >
> > @XmlRootElement
> > @XStreamAlias( "privilege" )
> > public class Privilege {
> >     private Long id;
> >     private String name;
> >     private String description;
> > }
> > Some of my output looks normal and some looks incorrect:
> > <list>
> > <role id="2497">
> >  <name>BcomPIM Admin</name>
> >  <privilege><id>588</id><name>CatalogViewAdmin</name></privilege>
> >  <privilege reference="../../role/privilege[3]"/>
> >  <privilege><id>593</id><name>ContentTypeAdmin</name></privilege>
> > </role>
> > </list>
> >
> > The incorrect part is this relative XPath expression:
> >  <privilege reference="../../role/privilege[3]"/>
> >
> > All Privilege objects do have names; also, if I'm not retrieving them
> Role
> > objects in a list, but rather a single one - everything works fine.
> > Any idea would could be causing the addition of the reference in the
> > output? Is this a known issue, or perhaps something I need to tweak? Can
> > it be because of the many to many association between Role and Privilege?
> > Any help is appreciated.
>
> This is normal if the *same* object appears twice in the object graph, see
> http://xstream.codehaus.org/graphs.html. The article also explains the
> alternatives and consequences.
>
> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to