-
Sorry for the newbie question, I need to parse an xml into a (data) class, which it starts as:
This is my code:
but I get:
What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When serializing some example data it is clearer. Comment is a string so is by default serialized as attribute, not as element. The error doesn't clarify this (yet). To fix it you need to make comment serialize as element. The easiest way to do that is the |
Beta Was this translation helpful? Give feedback.
When serializing some example data it is clearer. Comment is a string so is by default serialized as attribute, not as element. The error doesn't clarify this (yet). To fix it you need to make comment serialize as element. The easiest way to do that is the
@XmlElement(true)
annotation. You will also want to set the serial name (or@XmlSerialName
) for the registry class (as otherwise the capitalised class name is used).