jaxb namespaces in each element instead of root element during marshalling

Posted by Anton on Stack Overflow See other posts from Stack Overflow or by Anton
Published on 2010-03-05T08:56:55Z Indexed on 2010/03/29 3:03 UTC
Read the original article Hit count: 619

Filed under:
|
|
|
|

By default, jaxb 2 lists all (all possible required) namespaces in root element during marshalling:

<rootElement xmlns="default_ns" xmlns:ns1="ns1" xmlns:ns2="ns2"> <ns1:element/> </rootElement>

Is there a way to describe namespace in each element instead of root element ?:

<rootElement xmlns="default_ns"> <element xmlns="ns1"/> </rootElement>

It also solves the problem of "unnecessary namespaces", which is also important in my case. Any suggestions appreciated.

© Stack Overflow or respective owner

Related posts about jaxb

Related posts about jaxb2