users@jaxb.java.net

Re: how to marshal an object to document fragment

From: Gary Gregory <ggregory_at_seagullsw.com>
Date: Mon, 27 Jan 2003 17:35:38 -0500

I just started some impl. that require me to assemble several model objects
into one XML document. It is unfortunate that JAXB does not do this out of
the box. Thanks for the ContentHandler tip though.

Gary

-----Original Message-----
From: Ryan Shoemaker - JavaSoft East [mailto:Ryan.Shoemaker_at_Sun.COM]
Sent: Monday, January 27, 2003 2:29 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: how to marshal an object to document fragment


zhidong zhao wrote:
> How to set the marshaller to marshal a globe type into document fragment
string without xml
> prolog or xsi:xxx xmlns:xxx attributes?
>

There is no way to do this via the javax.xml.bind interfaces. We considered
adding
this feature to the 1.0 version of JAXB, but ultimately removed it. You
should be
able to marshal to a custom ContentHandler that strips the start|endDocument
events
out of the SAX stream.

--Ryan Shoemaker, Sun Microsystems, Inc.