[Simple-support] Deserialization problem, nested xml
Brought to you by:
niallg
|
From: Menashè E. <mel...@og...> - 2015-03-25 16:17:35
|
Hello,
I wonder why parametersList and also the attribute collectionName are null.
The annotated code:
@Root(name = "Datasets",strict=false)
public class ParametersContainer {
@ElementList(entry = "DiscoveryCode", inline = true)
@Path("Datasets/Dataset")
List<String> parametersList;
@Attribute(name = "collectionName")
@Path("Datasets/Dataset")
String collectionName;
@Override
public String toString() {
return parametersList.toString()+ " " + collectionName;
}
}
The (simplified) xml:
<Datasets>
<Dataset collectionName="test1" id="1">
<DiscoveryCode codeListValue="T1" >Test1</DiscoveryCode>
</Dataset>
<Dataset collectionName="test2" id="2">
<DiscoveryCode codeListValue="T2" >Test2</DiscoveryCode>
</Dataset>
</Datasets>
Without using @Path:
1. I had success reading the parametersList only when it was a second
level element (right under root.
2. I had success reading the attribute only once it was in the root
element, but this is not how my xml is built.
Thanks for reading.
--
With kind regards,
Menashè
|