If you use Aegis instead of JAXB, I suspect that you can align an
anyType with a JDOMElement and achieve happiness.

On Wed, 2008-01-09 at 13:31 -0800, jas_nabble wrote:
> Sadly, this does not work. I still get the '<' characters escaped as &lt;.  I
> updated the response object:
> 
> @XmlRootElement(name = "someResponse", namespace = "http://mynamespace.com";)
> @XmlType(name = "SomeResponse")
> public class SomeResponse {
>       
>       @XmlAttribute(name = "my-attr")
>       public String myAttr = "myAttryValue";
>       
>       @XmlAnyElement
>       public JAXBElement legacyXmlElement = new JAXBElement(
>                       new QName("http://mynamespace.com";, "legacyXML"),
>                       java.lang.String.class,
>                       "<x a=\"hello\"><y><z>data</z></y></x>");
> }
> 
> And the response is:
> 
> jas% curl http://localhost:8080/cxf1/rest/partner/forumTest
> <ns3:SomeResponse xmlns:ns3="http://ips.company.com/partner";
> xmlns:ns2="http://mynamespace.com"; xmlns="http://ips.company.com/types";
> my-attr="myAttryValue"><ns2:legacyXML>&lt;x
> a="hello">&lt;y>&lt;z>data&lt;/z>&lt;/y>&lt;/x></ns2:legacyXML></ns3:SomeResponse>
> 
> Thanks,
> 
> Jeff
> 
> 
> jas_nabble wrote:
> > 
> > Hello Benson:
> > 
> > @XmlAnyElement came up in the JAXB forum as well,  but I don't understand
> > how it applies to my problem. For one thing, the javadoc for XmlAnyElement
> > only discusses unmarshaling, so I'm not sure it applies to marshaling as
> > well. Even if it does, I don't want to parse the legacy XML and hand over
> > an Element.
> > 
> > However, would it be possible to use JAXBElement and set is value to the
> > XML String? Will that then get marshaled and not be escaped?  I'll have to
> > try that.
> > 
> > Thanks,
> > 
> > Jeff
> > 
> > 
> > Benson Margulies-4 wrote:
> >> 
> >> 
> >> On Wed, 2008-01-09 at 11:15 -0800, jas_nabble wrote:
> >>> 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.
> >> 
> >> Try looking into the @XmlAnyElement.
> >> 
> >> 
> >> 
> >> 
> > 
> > 
> 

Reply via email to