Hello,
I'm trying to read this simple string:
"<windSpeed units=\"kt\">27<radius>20</radius></windSpeed>"
using XmlMapper.
I use this "CxmlWindSpeed" class :
public class WindSpeed {
public static class Radius {
@JacksonXmlProperty(isAttribute = true)
private String sector;
@JacksonXmlProperty(isAttribute = true)
private String units;
@JacksonXmlText
private int value;
..../ Getters and Setters code/....
}
@JacksonXmlProperty(isAttribute = true)
private String units;
@JacksonXmlProperty(isAttribute = true)
private String source;
@JacksonXmlText
private int value;
@JacksonXmlElementWrapper(useWrapping = false)
private List<Radius> radius;
..../ Getters and Setters code/....
}
And this reading code:
WindSpeed speed=xmlMapper.readValue(cxmlWindSpeed, WindSpeed.class);
System.out.println(speed.getValue());
I get the value 0 instead of 27.
When I use this other string "<windSpeed units=\"kt\">27</windSpeed>"
the correct value 27 is read.
If I try to use a custom dezerializer, I find that with the first string jp.getCodec().readTree(jp) return a node with only 2 childs.
I'm using jackson 2.7.4 jars and stax2-api-3.1.1.jar + woodstox-core-asl-4.4.1.jar
Did I miss something ?
Thanks for your help.