Reputation: 57
Is there any other way to control the custom namespace prefixes using annotations other than in the package level annotation @Xmlns
.
Can it be done at the element level? Also is it possible to have one namespace with multiple prefixes?
Upvotes: 0
Views: 666
Reputation: 43651
What do you want to do, actually? Why are namespace prefixes important for you?
There are no standard element-level annotations for namespace prefixes.
The options to control namespace prefixes I know are:
@XmlNS
you already mentioned.NamespacePrefixMapper
.What I also can imagine:
@XmlElementRef
/@XmlElementRefs
normally use JAXBElements which have QNames which have prefixes. Maybe this prefix will be used.QName
-typed property (xs:QName
in XSD), it also may be used to add a namespace mapping.@XmlAnyElement
(containing DOM element).XmlAdapter
- I think there was an option somewhere for it to be NamespacePrefixMapper
-aware. (Actually needed for namespace-aware types like QName
).Upvotes: 1