On Mon, Nov 29, 2021 at 4:05 PM Lakshmi Narayana Malempati <
[email protected]> wrote:

> 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 +-



>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jackson-user/7a570eb5-6a5a-43fc-bb26-422864e2880en%40googlegroups.com
> <https://groups.google.com/d/msgid/jackson-user/7a570eb5-6a5a-43fc-bb26-422864e2880en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAGrxA26AdqA8h6v4zghnXDxWBFKz0ygEr%2BaeeyyEpGvJJdTd1g%40mail.gmail.com.

Reply via email to