Skip to content
Advertisement

Jackson XML marshal error when XmlAttribute and XmlElement have the same name

Jackson XML appears not to be able to marshal a XML having a tag with a certain attribute whose name is also being used for the nested children tags (“occ”, in the following case).

JavaScript

Changing the name of the XmlAttribute “occ” or of the XmlElement “occ” makes it work.

This is how I’ve annotated my Txt Class:

JavaScript

And this is how I’ve annotated the Occ class:

JavaScript

Advertisement

Answer

Apparently it’s an issue of the library. As of today, the issue hasn’t been solved yet:

https://github.com/FasterXML/jackson-dataformat-xml/issues/65

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement