users@jaxb.java.net

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

From: KARR, DAVID (ATTCINW) <"KARR,>
Date: Sat, 9 Jan 2010 08:34:59 -0800

> -----Original Message-----
> From: Pavel.Bucek_at_Sun.COM [mailto:Pavel.Bucek_at_Sun.COM]
> Sent: Saturday, January 09, 2010 12:51 AM
> To: users_at_jaxb.dev.java.net
> Subject: Re: How to marshal element without XML prolog, to avoid
> content before prolog?
>
> You should try set Marshaller.JAXB_FRAGMENT property to true.
>
> see
>
http://java.sun.com/javase/6/docs/api/javax/xml/bind/Marshaller.html#JA
> XB_FRAGMENT
>
> marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);

Thanks, that did it.

> KARR, DAVID (ATTCINW) wrote:
> > 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.
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net