EclipseLink/Release/2.4.0/JAXB RI Extensions/Namespace Prefix Mapper
Design Documentation: NamespacePrefixMapper
In the current JAXB RI, developed by Sun, there are a series of "proprietary" JAXB extensions that are available to provide advanced JAXB functionality outside of the JAXB spec (these extension classes reside in the com.sun.xml.bind package).
The NamespacePrefixMapper is one of these extensions - it allows the user to customize the namespaces and namespace prefixes used by a given Marshaller. By implementing the NamespacePrefixMapper interface and setting an instance on the Marshaller, the user can control how prefixes are assigned.
This document will outline the design for an EclipseLink equivalent to this extension.
- Provide an interface/abstract class the user can implement to provide custom namespaces.
- Provide the following callback methods:
- getPreferredPrefix - Whenever creating a prefix for a specific namespace uri, the PrefixMapper should be called to determine what prefix to use.
- getPreDeclaredNamespaceUris - Returns a list of prefix/namespace uri mappings that should be declared at the top of this xml document.
- getContextualNamespaceDeclarations - Returns a list of namespace declarations that will exist higher up in the document (in the case of marshalling into a SOAP message or something similar) and don't need to be re-declared.