users@jaxb.java.net

Re: Custom Marshalling

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 14 Aug 2003 14:17:59 -0700

> I'm trying to write a JAXB app to unmarshall an XML document and
> then marshall it back. The catch is that when I marshall it I want to
> replace elements of one type with an XML fragment that may contain
> one or more elements of other types. The replacement fragment will
> be generated dynamically and represented as a String.
>
> Is there a better way to accomplish this?

It seems like what you are really trying to do is a transformation after
the marshalling.

For example, you can apply XSL transformation to the output of the
marshaller by using the JAXBResult class. Or if you can write it a
stream-level transformation, you can write your own XMLFilter and have
JAXB marshal a content tree into your XMLFilter.

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net