0 Replies Latest reply on Apr 29, 2008 3:38 PM by acefrehley

    Java to XML for web services

    acefrehley

      Hi. I have a java pojo that I am converting to an XML string and then returning from a web service (JAXB). I have to make sure that the data is returned in a CDATA block, so I used XMLSerializer from this example as a guide:

      
      https://jaxb.dev.java.net/faq/JaxbCDATASample.java
      
      


      Everything works fine, but I have read that in Xerces 2.9.0, the XMLSerializer and OutputFormat classes are deprecated. What is the equivalent (non-deprecated) code for transforming a Java pojo to XML? I cannot find any examples online that do the equivalent type of this transformation using STAX or DOM.If anybody could share an example or their approach to doing this, that would be great.

      Also, I am using the Marshaller from JAXB, but just to reiterate, I also need the XMLSerializer functionality which prevents <> characters from being returned as HTML &lt; and &gt; tags to the client.

      Also, how can I find out what version of Xerces is used for a particular version of JBoss AS? I would like to know the Xerces version for JBoss AS 4.2.2 and 5.0. I checked inside the xercesimpl.jar in the lib/endorsed directory, but the manifest file said Xerces version 1.2? Am I reading that correctly?

      Thanks.