users@jaxb.java.net

Re: XmlJavaTypeAdapter issue

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 02 Oct 2006 11:21:17 -0700

Dan Diephouse wrote:
> Hiya,
>
> Here is an example where the names have been changed to protect the
> innocent:
>
> package com.acme.model;
>
> @XmlType(name="Customer")
> public class CustomerImpl {
> private String name;
> public String getName() {...}
> public void setName(String n);
> }
>
> I call:
>
> JAXBElement jel =new JAXBElement(new QName("http://ws.acme.com",
> "SomeCustomer"));
> marshaller.marshal(jel, outputStream);
>
> I expect this:
>
> <SomeCustomer xmlns="http://ws.acme.com">
> <name xmlns="http://model.acme.com">..</name>
> </SomeCustomer>
>
> I get this:
>
> <SomeCustomer xmlns="http://ws.acme.com">
> <name>..</name>
> </SomeCustomer>
>
> JAXB should use the namespace from the package on the <name> element, right?

Unless you have @XmlSchema(elementFormDefault=QUALIFIED), the default
rule mimics that of XML Schema, so you always get them in the default ""
namespace.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com