users@jaxb.java.net

Re: Help!! Elements & types

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 07 Aug 2003 11:23:35 -0700

This is a tricky issue. We are returning a type instance because that
allows you to stick that object to somewhere else where it expects
another type object.

But as you found out, it doesn't let you print that sub-element out
easily.

The next version of the RI will let you say something like:

    FooType t = ...;
    Foo foo = objectFactory.newFoo();
    foo.setType(t); // wrap into an element
    
    marshal(foo);

Hope that helps. In the short term, you might be able to work around
this problem by

    1. printing the start element <class>.
    2. marshal a type object without XML declaration.
    3. print the end element </class>

Search the archive for how to marshal without the XML declaration. (This
is another thing we are trying to address in the next release.)


regards,
--
Kohsuke Kawaguchi                  408-276-7063 (x17063)
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