Hi there,
When de-serializing the attached xml, the nested xml doc under the 'payload'
element comes blank. my code:
Background:
We have a java application that serializes java objects that are created
from XSD file using the JAXB library. Since jaxb does not support android,
we have started using jackson as this library will be consumed by android
app.
XmlMapper mapper = (XmlMapper) new
XmlMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
^^^^ Please PLEASE do not disable this until it is really needed -- this is what prevents
you from seeing the problem there is.
It is by far the most common issue with testing from what I have seen: users assume they
want this. But during development they typically do not.
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true);
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES, true);
Response response1 = null;
try {
response1 = (Response) mapper.readValue(xml, Response.class);
} catch (IOException e) {
e.printStackTrace();
}
I am new to java and jackson, Could you help me get past this?
Try leaving FAIL_ON_UNKNOWN_PROPERTIES enabled first; that will likely show
you that the structure of `Response` is different than what is needed for XML payload.
-+ Tatu +-