Re: Fwd: Deserialize - Implicit collection and attribute creating ambiguity

9 views
Skip to first unread message

Jörg Schaible

unread,
Nov 17, 2022, 5:51:59 PM11/17/22
to xstrea...@googlegroups.com
This is nothing than can be configured. You can write your own custom converter
for the type Variable that can handle the situation itself. See the tutorials.

On Thursday, 13. October 2022, 09:08:16 CET K Satya wrote:
>
> Hello team, can anyone help me on this please ?
>
> On Monday, October 10, 2022 at 9:40:34 PM UTC+1 K Satya wrote:
> > Hello Team,
> >
> > I am happy to find this group with a hope i get solution for my problem.
> >
> > Can anyone please help me to resolve my below problem. I have an xml
> > element with attribute named as “*value*” which can have one value E.g.
> > (1) below , but there can be another case which i can have it as a child
> > element named as “*value*” with multiple values E.g. (2) below.
> >
> > *E.g. 1*
> > <variable id="123" value="Adam"/>
> >
> > *E.g. 2*
> > <variable id="123">
> >
> > <value>Adam</value>
> >
> > <value>Philip</value> ... ...
> >
> > </variable>
> >
> > Can you please tell me how would i map this in Xstream serializer in same
> > java class? if i configure as below it gives me duplicate error
> > @XStreamAlias(“variable”)
> > public class Variable {
> >
> > @XStreamAsAttribute
> >
> > private String id;
> >
> > @XStreamAsAttribute
> >
> > private String value;
> >
> > @XStreamImplicit
> >
> > private List<String> value = new ArrayList<String>();




Reply all
Reply to author
Forward
0 new messages