According to this it is ok to have XML like
<root>
asdasda
<sub>qwertyuiop</sub>
</root>
However using Jackson XmlMapper (by default) to this kind of class:
@XmlRootElement
@Getter @Setter
public class Root {
private String sub;
}
gives an error:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "" (class org.example.jackson.unwrap.TestIt1$Root), not marked as ignorable (one known property: "sub"]) ...
Ok, I can add
xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
and I will get everything else but root text 'asdasda'.
What should I add to have 'asdasda' also in some field of class Root
instead of just ignoring it?