Class NamespacePrefixMapper

  • Direct Known Subclasses:
    NamespacePrefixMapper

    public abstract class NamespacePrefixMapper
    extends Object

    Purpose:Provides a means to customise the namespace prefixes used while marshalling An implementation of this class can be set on an instance of XMLMarshaller to allow for each instance of XMLMarshaller to use different namespace prefixes.

    • Constructor Detail

      • NamespacePrefixMapper

        public NamespacePrefixMapper()
    • Method Detail

      • getContextualNamespaceDecls

        public String[] getContextualNamespaceDecls()
        Returns a string array of prefixes and namespace uris that are already available in this context. Only required when marshalling to an output stream or a writer, since it's not possible to determine which namespaces are already in scope.
        Returns:
      • getPreDeclaredNamespaceUris

        public String[] getPreDeclaredNamespaceUris()
        Returns a list of namespace uris that should be declared at the root of the xml document being marshalled.
      • getPreDeclaredNamespaceUris2

        public String[] getPreDeclaredNamespaceUris2()
        Returns a string array of prefixes and namespace uris to be declared at the root of the document. This eliminates the need of implementing both getPredeclaredNamespaceUris and getPreferredPrefix since the prefix and uri can be associated here.
        Returns:
      • getPreferredPrefix

        public abstract String getPreferredPrefix​(String namespaceUri,
                                                  String suggestion,
                                                  boolean requirePrefix)