users@jaxb.java.net

How to marshal element without XML prolog, to avoid content before prolog?

From: KARR, DAVID (ATTCINW) <"KARR,>
Date: Fri, 8 Jan 2010 15:14:02 -0800

I've got some code where I have to construct a SOAP message string,
where I have objects that I can marshal with JAXB, whose marshaled
content has to go into the SOAP message. I'm presently just trying to
marshal each of the individual objects, then appending that to my XML
string. The problem appears to be that the resulting marshaled output
of each object contains an XML prolog. When I put the resulting
substring into the total SOAP message string, I end up with "content
before prolog" errors, which seems reasonable under the circumstances.

Is there an easy way to make the marshalling process not emit the XML
prolog, as opposed to trying to manually remove the prolog at the start
of each fragment?

I was avoiding trying to do this with SAAJ, I'm not sure whether that
will be harder or not.