I have a requirement in which I have XML like this
<programs>
<program>
<name>test1</name>
<instr><![CDATA[ some string ]]></instr>
</program>
<program>
<name>test2</name>
<instr><![CDATA[ some string ]]></instr>
</program>
</programs>
My program should unleash this JAXB, do some processing, and finally marshall back to xml. When I finally marshaled JAXB objects in xml, I get plain text without the prefix CDATA. But in order to keep xml intact, I need to return xml with CDATA prefix. JAXB does not seem to support this directly. Is there any way to achieve this?
source
share