users@jaxb.java.net

Re: Partial Marshalling

From: Steven Waldren <swaldren_at_aafp.org>
Date: Fri, 21 Oct 2005 19:30:47 -0500

Thanks for the blog entry, it was helpful. I have attached a Class that the
XJC ant task generates (one of many of course) for the XSD I am working
with. I am having trouble understand why I get the following behavior:

A call to marshaller.marshal (ccr.getBody(), System.out); causes
marshalling of the <Body> and child elements (without the actual <Body>
tag). That I understand.

A call to marshaller.marshal (ccr.getActors(), System.out); causes nothing
to be marshalled. That I don't understand.

I tried to add a @XmlRootElement annotation to Actors.class but that did
nothing.

Is there a way to only marshal <Actors> and its child elements?

Thanks,
Steven
-- 
Steven E. Waldren, MD, MS
Assistant Director, Center for Health Information Technology
American Academy of Family Physicians
http://www.centerforhit.org/
> From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
> Reply-To: <users_at_jaxb.dev.java.net>
> Date: Fri, 14 Oct 2005 11:48:51 -0700
> To: <users_at_jaxb.dev.java.net>
> Subject: Re: Partial Marshalling
> 
> Steven Waldren wrote:
>> Hello,
>> 
>> I read through the archives regarding Partial Marshalling and read about and
>> have the source for ElementWrapper. It using a deprecated interface
>> XMLSerailizer. Also the threads were from 2003
>> 
>> What is the latest around partial Marshalling?
> 
> Use JAXBElement.
> See 
> http://weblogs.java.net/blog/kohsuke/archive/2005/10/101_ways_to_mar.html
> 
>> Some of my Java generated classes I can marshal - although the root element
>> is missing-- and some will not marshal anything (Collections).
> 
> Collection, Map, etc can't be marshalled with JAXBElement unfortunately.
> See my post.
> 
> -- 
> Kohsuke Kawaguchi
> Sun Microsystems                   kohsuke.kawaguchi_at_sun.com