users@jaxb.java.net

Re: unexpected results when marshalling

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 28 May 2003 09:45:01 -0700

Tommy Berglund <tommy.berglund_at_pipebeach.com> wrote:
> Hello,
>
> I have a problem when marshalling objects in my application. To easily
> show you I have modified SampleApp1 slightly so it can print objects to
> System.out like this:
>
> ..
> Items items = po.getItems();
> // m is defined as static Marshaller m;
> m.marshal( items, System.out );
> ..

> why are the <items> and </items> elements excluded? is it possible to
> get them included in the marshalled output?

Because Items are defined to be a type and not an element. So
essentially you need to wrap it into another element. Someone has posted
a wrapper class that lets you print out an element around it, so search
the archive and you should be able to find it.

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com