On Mon, Dec 7, 2009 at 23:43, Ramya K Grama <ramyakgr...@gmail.com> wrote: > I dont understand. > It is a simple case where a Axis2 webservice, implemented with > XMLBeans databinding, needs to send CDATA out in the response XML, > preserved/intact - without characters being escaped.
This is not supported since in the context of a Web service, since this is not a valid requirement (because the consumer must not make a difference between a CDATA section and an equivalent text node). If you have a consumer of your service that requires a CDATA section, you should challenge that requirement. > And from what I understood from your previous reply is that this can > be done by using AXIOM APIs to set the contentType to CDATA. > Which makes sense to me, but need some help with the API - how could > one get hold of the underlying AXIOM element from XMLBeans inorder to > set the contenttype to CDATA. You will have to inspect the generated code to see if it is possible to get hold of the OMElement produced from the bean. > > > On Mon, Dec 7, 2009 at 5:09 PM, Andreas Veithen > <andreas.veit...@gmail.com> wrote: >> I'm not aware of any XML data binding framework that would allow you >> to control whether something is serialized as a text node or a CDATA >> section. This is by design, because the difference between a text node >> and a CDATA section is only syntactic, but has no semantic meaning. >> This implies that any system that processes a CDATA section >> differently from an equivalent text node should be considered as >> broken. At least that is the what most people in the industry believe. >> >> Andreas >> >> On Mon, Dec 7, 2009 at 21:49, Ramya K Grama <ramyakgr...@gmail.com> wrote: >>> Thanks for the quick reply! >>> I am using XMLBeans 2.3.0. I am not using AXIOM APIs directly to >>> create the response elements. >>> Hence, I am not using OMText directly. >>> From the XMLBean api, I am able to use only setText and have not found >>> a way to passin the CDATA type (neither in an overloaded setText nor >>> in a setType). >>> >>> Could you please share a code snippet showing how to pass the CDATA >>> type using XMLBeans or how to get the OMText node from the XMLBean >>> object. >>> With XMLBeans I have <operationName>Document object. How do I get an >>> OMText out of it to be able to set the Type. >>> >>> >>> >>> >>> On Mon, Dec 7, 2009 at 3:39 PM, Andreas Veithen >>> <andreas.veit...@gmail.com> wrote: >>>> XMLInputFactory.properties can be used to preserve CDATA sections when >>>> using Axiom to _parse_ an XML document (By default CDATA sections are >>>> transformed to text nodes and coalesced with adjacent text nodes). On >>>> the other hand, creating CDATA sections in output documents is >>>> something that Axiom has always supported. >>>> >>>> Probably what you are doing is to create an OMText node with type TEXT >>>> and content "<![CDATA[ROSEANNA]]>". In the output document, this gets >>>> of course escaped. What you need to do instead is to create an OMText >>>> node with type CDATA and content "ROSEANNA". >>>> >>>> Andreas >>>> >>>> On Mon, Dec 7, 2009 at 20:45, Ramya K Grama <ramyakgr...@gmail.com> wrote: >>>>> Hello, >>>>> We have been having issues with CDATA not being preserved by Axis2. >>>>> In the response xml, the '<' are escaped to '<' >>>>> So instead of <someTagName><![CDATA[ROSEANNA]]></someTagName> we get >>>>> <someTagName><![CDATA[ROSEANNA]]></someTagName> in the response. >>>>> >>>>> Reading this >>>>> http://people.apache.org/~veithen/synapse/faq.html#cdata >>>>> suggestion, we tried creating XMLInputFactory.properties file >>>>> containing this single line - javax.xml.stream.isCoalescing=false >>>>> and placed the file under WEB-INF/classes and retried, again the same >>>>> result. >>>>> >>>>> We are using Axis21.4, XMLBeans 2.3.0, Tomcat 6. >>>>> >>>>> The other idea was to programatically replace the escape characters >>>>> using regular expressions - which I think is really not needed. >>>>> >>>>> Any help is highly appreciated. >>>>> >>>> >>> >> >