users@jaxb.java.net

Re: schema location or namespace of JAXB object

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 30 Jul 2007 12:25:17 -0700

Kenny is right that JAXB doesn't rely on schemas at runtime.

Kenny MacLeod wrote:
> You know, the more I think about this, the less I understand... for the
> life of me, I can't see how the namespace URI is marshalled when the
> annotated classes contain no such information. It must be something
> obvious, but I can't see it.
>
> Anyone?
>
>> - How does JAXB manage to marshal a .xml with the schema location and
>> namespace information
>> when the only argument I give to the marshaller is the ObjectFactory ?

Marshaller gets to access all the information in JAXBContext, which
knows a lot. Try JAXBContext.toString().

All the necessary information is captured in the annotations.

>> - When my .xml is unmarshalled, how the unmarshaller manages the schema
>> location and namespace information ?

The same as above.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com