XML strings in JAXB

Posted by OOO on Stack Overflow See other posts from Stack Overflow or by OOO
Published on 2010-06-03T07:14:38Z Indexed on 2010/06/03 7:24 UTC
Read the original article Hit count: 335

Filed under:
|
|

I have a JPA entity class mimicking a table. Something like this:

@XmlType(name="MyClassElementType")
public class MyClass {
    String name;
    String xmlDesc;

    public MyClass() {}

    @XmlElement
    String getName() { return name; }
    void setName(String name) { this.name = name; }

    @XmlElement
    String getXmlDesc() { return xmlDesc; }
    void setXmlDesc(String xmlDesc) { this.xmlDesc = xmlDesc; }
}

In a Jersey REST get call I'm trying to return this class:

@Get
@Produces("application/xml")
public MyClass get() {

    return myClass;
}

Now I'm expecting the already xml string(xmlStr) to be returned as is, but Jersey/JAXB escapes it...

So anyway around this?

© Stack Overflow or respective owner

Related posts about java

Related posts about jaxb