XML : JAXB output error with "<" or ">"

I'm using the version of Jaxb 2.2.11, I want to print the string "<" or ">" but I can't, with my code my output is: "<".

Example:

   <contentHtml>&lt;![CDATA[&lt;table width="1650" border="2"&gt;&lt;tr   width="1650"&gt;&lt;td width="825"&gt; TEXTBOX 1.1&lt;/td&gt;&lt;td   width="825"&gt; TEXTBOX   1.2&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;]]&gt;</contentHtml>    

My Code is:

  try {                  JAXBContext context = JAXBContext.newInstance(test.class);                  Marshaller m = context.createMarshaller();                  m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);                    m.marshal(testObject, new File("data/test.xml"));                } catch (JAXBException e) {                  e.printStackTrace();              }    

How is the way to print properly this signs "<" or ">"?

No comments:

Post a Comment