users@jaxb.java.net

Re: remove namespace prefix from child elements by setting default namespace locally?

From: ginger <ggtech888_at_gmail.com>
Date: Thu, 24 Mar 2011 10:12:54 -0400

Hi, Wolfgang,

Thank you for the nice reply. Maybe I did not make it clear. We have the
namespace A and B well defined already and Aroot and Broot are there. It
is the marshalling process that we need to have more control of. When we
use another package that does not use JAXB for
marshalling/unmarshalling, we get the result of what we want like

<Aroot xmlns="http://www.w3.org/2005/A">
<Achild....>
<Broot xmlns="http://www.w3.org/2005/B">
<Bchild....>
                . ..
</Bchild>
</Achild>
</Aroot>

where namespace declaration is mentioned at the first node of that
namespace and prefix is set to default for current namespace. There is
no 'Global' NS prefix there

But I don't see such option in JAXB. Nope, we don't use xjc. JAXB is
called by RESTEasy, which is the package we are using for RESTful API
implementation


Hope it sounds clearer this time



-------------------------------------
Prefixes are just shorthands for the lengthy namespace URIs.

Primarily, you'll have to put Aroot into namespace
http://www.w3.org/2005/A and Broot into namespace
http://www.w3.org/2005/B <http://www.w3.org/2005/A>. The namespace is
derived from the package, or set by customization; or you define it
directly in an annotation (if you don't use xjc and generated Java sources).
--------------------------------------