0

i am trying to add <![CDATA[ tag inside xml. how i can do that.

Result will be like this :-

<CERequest>
<inflow format="1">
<![CDATA[ 
<DOC id="2229901"></DOC>
]]>
</inflow>
</CERequest>

My java Object :-

**CERequest.java **

public class CERequest {
private Inflow inflow;
}

Inflow.java

public class Inflow {   
@XmlAttribute
private String format;
}

**Converting java object to xml **

JAXBContext jaxbContext = JAXBContext.newInstance(CERequest .class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
StringWriter sw = new StringWriter();
jaxbMarshaller.marshal(cEOutputRequest, sw);
String xmlString = sw.toString();
System.out.println(xmlString);

after converting how to get cdata

0 Answers0