Class NamespaceMapping

  • All Implemented Interfaces:
    NamespaceResolver

    public class NamespaceMapping
    extends Object
    implements NamespaceResolver
    A Simple Namespace Mapping table. Mappings can be added and then the object can be used as a NamespaceResolver. Additionally, it can be based on a underlying NamespaceResolver
    • Constructor Detail

      • NamespaceMapping

        public NamespaceMapping()
      • NamespaceMapping

        public NamespaceMapping​(NamespaceResolver base)
        Constructor
        Parameters:
        base - fallback resolver
    • Method Detail

      • hasPrefix

        public boolean hasPrefix​(String prefix)
        Returns true if prefix is already mapped to some URI. Returns false otherwise.
        Parameters:
        prefix - prefix to check
        Returns:
        true if prefix is mapped
      • removeMapping

        public String removeMapping​(String uri)
        Clear the mapping for an URI
        Parameters:
        uri - URI to clear the mapping for
        Returns:
        The prefix the URI was mapped to or null if it was not mapped.
      • getPrefixToURIMapping

        public Map<String,​String> getPrefixToURIMapping()
        Return a Map of prefix to URI mappings currently registered. The returned Map is a copy of the internal Map.
        Returns:
        Map
      • getURIToPrefixMapping

        public Map<String,​String> getURIToPrefixMapping()
        Return a Map of URI to prefix mappings currently registered. The returned Map is a copy of the internal Map.
        Returns:
        Map