Hi Ranier,

To use namespaces in a mapping file you need to do the following:

1. declare the namespace, with an associated prefix

  - the prefix can be anything, it's just used within the mapping file
    to associate the namespace with the proper fields.

2. For all non root elements/attributes use that prefix in the
bind-xml/@name 
   in order to associate the namespace.

3. For the Root element (top-most element) use the map-to/@ns-uri
   to associate the namespace.

For example:

<mapping xmlns:foo="http://www.vpbank.com/ebanking";>

...
  <class name="org.acme.Root">
     <map-to ns-uri="http://www.vpbank.com/ebanking"/>
     ...
     <field name="languageCodeISO" ...>
         <bind-xml name="foo:languageCodeISO"/>
     </field>

</mapping>

Now that field languageCodeISO is associated with the proper namespace,
the xmlns="" should disappear.

--Keith

Rainer Mueller wrote:
> 
> Hello,
> 
> we have a problem with the default namespace using Castor 0.9.5.2
> 
> I tried both statements
> 
> marshaller.setNamespaceMapping("", "http://www.vpbank.com/ebanking";);
> 
> marshaller.setNamespaceMapping(null, "http://www.vpbank.com/ebanking";);
> 
> but it generates elements with <languageCodeISO xmlns="">de</languageCodeISO> but 
> the xmlns="" should not appear
> 
> In the mapping file we specify ns-uri="http://www.vpbank.com/ebanking"; as well, 
> without success.
> 
> Can you help me with this issue, is there a solution or is it a Castor bug?
> 
> Thanks,
> Rainer
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to