Reputation: 163
I have an XML file and I need to set it up with my POJO class
<ids xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" >
<a:string>100</a:string>
<a:string>101</a:string>
<a:string>102</a:string>
... etc..
</ids>
Which annotation do I have to use, to fetch these values
I am using the following way.
@XmlElement(name="string",namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays")
protected List<String> id;
but I am getting null
Upvotes: 1
Views: 260
Reputation: 12245
You did not present the class containing protected List<String> id
. It should be something like
@XmlRootElement(name = "ids")
public class Wrapper {
@XmlElement(name = "string",
namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays")
protected List<String> id;
}
to have the list populated. Also you can name the class Ids
and remove name = 'Ids'
.
Upvotes: 1