users@jaxb.java.net

Re: XmlJavaTypeAdapter issue

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 27 Sep 2006 15:34:28 -0700

Dan Diephouse wrote:
> Hiya,
>
> I'm trying to get my XmlJavaTypeAdapter on an interface to work with the
> code first approach. I'm wondering, should I be specifying the interface
> or type class to jaxb. Let me try to explain the two areas... I have an
> interface Customer and an implementation CustomerImpl. In my jaxb.index
> - should I put Customer there or CustomerImpl?

CustomerImpl.


> Also when I do:
>
> new JAXBElement(qname, class, object);
>
> Should my class be Customer or CustomerImpl?

CustomerImpl.

> I tried Customer but JAXB
> complains that its an interface. I tried CustomerImpl, but JAXB is
> serializing it wrong - its using the namespace from the qname on all the
> child elements (i.e. customer.name, customeraddress) instead of using
> the package generated namespace.

When you marshal out a JAXBElement, it should always take the tag name
from the first QName parameter that you pass to JAXBElement, never from
the class.

Can you show me your CustomerImpl class definition, package-info.java,
and the infoset that JAXB generated?

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com