title: CDATA in JAXB inside CXF
body: <p>I am writing a JAX-RS webservice . Which returns a Reponse back in form of application/xml .In that I have to produce CDATA sections . I have researched a lot and I have seen many blogs . But I am still not able to do so . I have tried following approaches:</p>
  
  <p>1) Writing your own Jaxb2Marshaller as mentioned here : <a href="http://www.coderanch.com/t/584332/Web-Services/java/Spring-WS-JAXB-CDATA" rel="nofollow">http://www.coderanch.com/t/584332/Web-Services/java/Spring-WS-JAXB-CDATA</a> . And I have configured like below :</p>
  
  <pre><code>&lt;bean id="marshaller" class="com.test.CdataJaxb2Marshaller"&gt;
  &lt;property name="classesToBeBound"&gt;
      &lt;list&gt;
   &lt;value&gt;com.test.MyModel&lt;/value&gt;
      &lt;/list&gt;
  &lt;/property&gt;
  &lt;property name="cdataElements"&gt;
      &lt;list&gt;
          &lt;value&gt;Data&lt;/value&gt;
      &lt;/list&gt;
  &lt;/property&gt;
  &lt;/bean&gt; 
  </code></pre>
  
  <p>But I am not getting a call in marshall method of the CdataJaxb2Marshaller . I am wondering that I have configure the the marshaller inside the  or somewhere else . Could someone suggest .</p>
  
  <p>2) The second approach I have tried is mentioned here : <a href="http://mail-archives.apache.org/mod_mbox/cxf-users/201203.mbox/%3CCAEDT_BW49HTNZtad5P+GoGZLpLYTnEwO50dzUuPNKnpWsy=rdQ@mail.gmail.com%3E" rel="nofollow">http://mail-archives.apache.org/mod_mbox/cxf-users/201203.mbox/%3CCAEDT_BW49HTNZtad5P+GoGZLpLYTnEwO50dzUuPNKnpWsy=rdQ@mail.gmail.com%3E</a> . But I doesn't talk about how to configure CdataWriterInterceptor inside 
  I tried configuring as follows :
      
       
   
  
  <p>3) Third approach I tried is very similar to the the second , with the difference that instead of  Interceptor I configured a provider , something thats mentioned here :</p>
  
  <p><a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamWriterProvider.java" rel="nofollow">http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamWriterProvider.java</a></p>
  
  <p>I don't want to use some third party stuff like eclipse link Moxy . Alas JAXB natively doesn't support CDATA sections . It would be great help if someone has an anwser to this problem.</p>
  
  <p>Thanks,
  Aman.</p>