-
Notifications
You must be signed in to change notification settings - Fork 20
Jackson can't handle @XmlElements and @XmlElementWrapper correctly #34
Comments
Hmmh. Odd. That should be something that could be supported, at least piece-wise. One thing to check, first, would be to see what Jackson XML produces: that is, is there structural difference, or is something just being ignored. |
I'm trying to read similar structure - I am not considered yet by writing, however it's get hard to proceed with some of XML weirdness (from JSON point of view). I was trying to get this done with annotations: @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include =JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
@JsonSubTypes.Type(name = "double", value = Double.class),
@JsonSubTypes.Type(name = "integer" , value = Integer.class)
})
@JacksonXmlElementWrapper(localName = "items")
private List<Number> checks; I am unable to get this kind of construction working with any type - when I try to map complex structure. I think issue comes from bad state of parser in given place: |
Hmmh. This could be related to types in question; while it should definitely work, handling of primitive/wrapper types may cause some wrinkles. One thing to try out is to see what XML looks like when serializing this POJO. Guarantee that Jackson module gives is that it should be able to read anything it writes; so problems fall into two categories:
|
In my case I am limited only to reading cause I am integrating with 3rd party system which produces XML without any schema and shape of output is hard to cover with JAXB. I have found in #125 that guilty of weirdness is sub typing and it does affect @JacksonXmlElementWrapper. |
Right, existing hard-coded XML structures are tricky. |
Any news here? |
I think this is affecting me too - I either get this issue, or I get an issue where it won't ignore whitespace within an XmlElementWrapper element. |
Will need to be moved to https://github.com/FasterXML/jackson-modules-base/issues as this repository is deprecated. Not sure what would be the best way as github has no transfer for issues, and I would like to get good updated description of the issue (which remains). |
Code written below works perfectly with plain JAXB but causes issues with Jackson. I found no way to handle similar structure by Fasterxml - wrapper + child elements having various names.
The text was updated successfully, but these errors were encountered: