users@jersey.java.net

how to marshall an xml text field

From: John Calcote <john.calcote_at_gmail.com>
Date: Fri, 27 Aug 2010 12:17:38 -0600

 This is more a JAXB question than a Jersey question, but I was hoping
someone on this list might be willing to impart hard-earned knowledge...

I have a situation where I want to send an xml document as a field in a
JAXB message. I don't want JAXB to know anything about the contents of
this field - specifically, I don't want JAXB to marshall this field to
and from XML. I just want to treat it as raw XML. The reasons for this
have to do with the layers in our code that interpret the contents of
this field. I'm using JAXB at the lowest layer, but the field contents
are injected at one end from a much higher layer, and consumed from that
same higher layer at the end of the transmission. Thus, from the message
transport's perspective, I want it to appear to just be raw text.

I've spoken with colleagues about this problem. One says you should use
byte array to keep JAXB from messing with the encoding of the embedded
xml text. Another says String should would fine.

Suggestions?

Thanks in advance,
John