Hi Team, Hope you are fine.
Can you 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>();