Hello: I'm so far successfully making use of CXF 2.0.3 using JAXB 2.0. However, a problem I have to resolve pertains to returning as part of a response, existing XML that is already in the for of java.lang.String. This content is coming from legacy code accessing database CLOBs. They can be pretty large, and they don't change. There are lots of them (~100K). I would rather not parse them into an object graph that could be marshaled by JAXB, or cache those graphs in memory etc. I did see the email thread "Return direct XML", but that seems to involve creating a DOM.
Here is a simple example of the issue. The following is a simple bean being returned by my CXF based web service. I this example, the legacy String based XML is simply defined inline. package mypackage; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; @XmlRootElement(name = "someResponse", namespace = "http://mynamespace.com") @XmlType(name = "SomeResponse") public class SomeResponse { @XmlAttribute(name = "my-attr") public String myAttr = "myAttryValue"; @XmlValue public String legacyXml = "data"; } The legacyXml property value is marshaled and escaped with entity references (i.e. < vs. <, etc.). This makes perfect sense. But, is there a way to turn it off for that property? I would like to simply pass that wad of XML represented as a String straight through with no escaping being performed. I can see the JAXB 2.0 RI defines a MarshallerImpl property by the name of com.sun.xml.bind.characterEscapeHandler which one can set to an instance of com.sun.xml.bind.marshaller.CharacterEscapeHandler. So, I can create an implementation that basically performs no escaping, and assign it to the marshaller. But, that will apply to all marshaling performed, which is not what I want. I only want the escape handler applied to a particular property. I'm trying to do all this via Apache CXF (2.0.3), so I am not creating the marshaller myself. There is a documented process for setting marshaller properties in CXF, but at least with 2.0.3 that capability is not there (no contextProperties property defined for org.apache.cxf.jaxb.JAXBDataBinding). But even if that did work, it would still apply to the marshaller as a whole. Is it possible to chain marshallers? That is, could I define class that represents non-escaped data, and marshal an element of that type using a marshaller setup with my custom [non-]escape handler, and then marshal the remaining elements with escaping enabled? I've not had any luck resolving this in the JAXB forum (http://forums.java.net/jive/message.jspa?messageID=251044#251044), parts of which I reproduced here, and I'm not sure if this is a JAXB or CXF issue. I know nothing of Aegis, would that be a way to get what I need? Thanks! Jeff -- View this message in context: http://www.nabble.com/Returning-XML-that-is-already-a-String-tp14718968p14718968.html Sent from the cxf-user mailing list archive at Nabble.com.
