Skip to main content

Ability to set Namespace mapper in the JAXBContext instead of Marshaller.

2 replies [Last post]
sameer_v_rao
Offline
Joined: 2005-05-03
Points: 0

The Marshaller is not Thread safe and hence it is recommended to create a new instance while working with it. JAXBContext is however thread-safe and is recommended to keep a singleton for improved performance.

With this in mind, I think a feature of being able to specify namespace mapper at a JAXBContext level would be preferrable.

Even otherwise, most of time, users would want to use same namespace mapping irrespective of how many times the marshall contents to XML document.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09
Points: 0

The other design aspect of JAXBContext is to be immutable. So for us to do something like this, it needs to be set during JAXBContext instantiation.

But otherwise it feels like a reasonable RFE. Would you be interested in filing this as an RFE to https://jaxb.dev.java.net/issues/ ?

sameer_v_rao
Offline
Joined: 2005-05-03
Points: 0

Done. # 398.

Thanks much!