Force JacksonXml to serialize raw value as string Force JacksonXml to serialize raw value as string json json

Force JacksonXml to serialize raw value as string


The problem is that your xml is invalid. if you want html content embedded within an xml element, then you need to properly encode the content. if you are generating the content, then any reasonable xml generator should handle that encoding for you.

you xml should look something like:

<lookup_info>-- [Snipped] --------------<BR/>Some more snipped data.<BR/><BR/>And some more snipped data..<BR/><BR/>And even more snipped data...</lookup_info>


You may try underscore-java library. It has a static method U.fromXmlMap(xml). I am the maintainer of the project.

Output map:

{  "lookup_info": {    "#text": "-- [Snipped] --------------",    "BR": [      {        "-self-closing": "true"      },      {        "#item": {          "#text1": "\nSome more snipped data."        }      },      {        "-self-closing": "true"      },      {        "-self-closing": "true"      },      {        "#item": {          "#text2": "\nAnd some more snipped data.."        }      },      {        "-self-closing": "true"      },      {        "-self-closing": "true"      }    ],    "#text3": "\nAnd even more snipped data..."  },  "#omit-xml-declaration": "yes"}