users@jaxb.java.net

Re: Can I unmarshal an unnamespaced message with a schema?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Sat, 26 Feb 2011 07:38:18 +0100

Since you'll have to change your program, and change it back again later:
what about simply regenerating the classes from a schema without the
namespace?
This would be a clean solution.

If you insist on a hack: just modify the string containing the message.

(You can also parse the string into a DOM tree, manipulate this and then
call the unmarshaller. Clean, but work.)

-W


On 25 February 2011 21:28, KARR, DAVID (ATTSI) <dk068x_at_att.com> wrote:

> I have a schema defined in a namespace, and I've generated JAXB classes
> from that namespace. When the message is valid for that schema, being
> that it has the "xmlns" attribute and the elements in the body are valid
> for that schema, then everything works fine.
>
> I have a temporary problem that the message I'm receiving doesn't have
> the namespace specified, even though the body is valid for that schema.
> When I try to unmarshal the message, I get a schema validation error
> because the body element's namespace doesn't match the expected
> namespace.
>
> I expect the body element will be fixed soon, but I'm blocked until it's
> fixed. Is there a temporary workaround I could implement in how I
> create or call the unmarshaller, to get around this in the mean time?
>