I’m trying to retrieve an XML which has this format:
<roles>
<role>manager</role>
<role>driver</role>
</roles>
I use this classes and annotations:
public class Clazz(){
private Role roles;
get/set
}
public class Role (){
private String role;
get/set
}
With this annotations i’m able to retrieve only the first role, i.e.:
<roles>
<role>driver</role>
</roles>
What should i change in order to take and the other role? The number of the role is not standard, sometimes could be one, other two and other 3.
Try this:
Note that you have several
<role>nodes so obviously you need a collection to hold all of them.