Open kalyansagi opened 1 year ago
Correct: this is not currently supported: attribute-ness is really only used for serialization but not used to distinguish source for incoming properties.
I will leave this open as a request to support such cases.
@cowtowncoder Thanks for your response. How do I cross this bridge? Any other recommendations?
@kalyansagi Unfortunately I cannot think of many work-arounds. Theoretically I guess you could use readTree
to get structure in which all data is retained (duplicates are actually supported, resulting in ArrayNode
s), and then post-process content, but that would not retain attribute/element distinction.
I have a similar problem, the XML schema of the german electronic medication plan (eMP) contains an element MP which has an attribute U as well as child elements U. I'm using the jaxb2-maven-plugin (with some additional binding configuration) to generate the mapping Java classes. Unfortunately, neither the deserialization nor the serialization works and I get the same exception as the OP.
Support for such scenarios would be greatly appreciated.
We are using jackson-dataformat-xml to convert an XML to JavaObject. Our use case is very peculiar such that the name of the attribute and element are the same in our XML. See the below sample.
`
`
JavaObject:
`@XmlRootElement public class Work {
}`
Implementation:
Errors: