I have a XML Document where there are nested tags that should not be interpreted as XML tags
For example something like this
<something>cba<a href="linktosomething.com">abc</a></something>
should be parsed as a plain String "cba<a href="linktosomething.com">abc</a>"
(it should be mentioned that the document has other elements as well that get parsed just fine). Jackson tho tries to interpret it as an Object and I don't know how to prevent this. I tried using @JacksonXmlText
, turning off wrapping and a custom Deserializer, but I didn't get it to work.
The
<a
should be translated to<a
. This back and forth conversion normally happens with every XML API, setting and getting text will use those entities&...;
.An other option is to use an additional CDATA section:
<![CDATA[ ... ]]>
.If you cannot correct that, and have to live with an already corrupted XML text, you must do your own hack:
Repairing: