users@jaxb.java.net

Re: Marshal/unmarshal contained objects

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 24 Sep 2003 16:42:03 -0700

> I unmarshal an xml document containing an alarm_profile_list and this gives
> me an AlarmProfileList object. Calling getAlarmProfile() on this list object
> gives me a List of AlarmProfileType objects. I'd like to take one of the
> AlarmProfileType objects and marshal it out as an xml document, however the
> resulting document contains no root element. I'd like the marshalled version
> of AlarmProfileType to contain the <alarm_profile></alarm_profile> tags, is
> this possible?

Unfortunately there's no easy way to do this now.

However, you can copy what this guy did:

    https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgId=11323

References to com.sun.xml.bind.serializer.XMLSerializable needs to be
changed to your.package.impl.runtime.XMLSerializable, though.

And also see my related post:

    https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgId=11079

Also, our next release should be able to let you do this more easily
out-of-the-box.


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