users@jaxb.java.net

Re: can someone help me understand namespaces in the context of (un)marshalling?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 17 Feb 2005 14:48:16 -0800

jon gold wrote:
> i'm having a lot of trouble lately trying to unmarshal documents, and
> also not fully understanding the results of marshalling.
>
> trying to unmarshal
>
> <?xml version="1.0"?>
> <foo xmlns="http://somens">
> <bar>...</bar>
> ...
> </foo>
>
> fails with 'unexpected element {http://somens}:bar', but succeeds when
> the document contains
>
> <bar xmlns="">...</bar>

Depending on the schema, that seems like a correct behavior to me. It
really depends on how "bar" is declared.

The change you made was a very significant change --- it changed the
namespace URI of the bar element. So if one was valid, the other is
definitely invalid.

> PS: the jaxb archive search is still only returning this month's results
> for me.

I'll ping the admins again...

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com