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.
From stackoverflow
-
The answer is negative, JAXB does not support such low-level customization. Consider using XSLT to post-process the marshalled XML.
0 comments:
Post a Comment