By default, jaxb 2 lists all (all possible required) namespaces in root element during marshalling:
Is there a way to describe namespace in each element instead of root element ?:
It also solves the problem of "unnecessary namespaces", which is also important in my case. Any suggestions appreciated.