Class ReadWriteNamespaceRegistry

    • Constructor Detail

      • ReadWriteNamespaceRegistry

        public ReadWriteNamespaceRegistry​(Root root)
    • Method Detail

      • registerNamespace

        public void registerNamespace​(java.lang.String prefix,
                                      java.lang.String uri)
                               throws RepositoryException
        Description copied from interface: NamespaceRegistry
        Sets a one-to-one mapping between prefix and uri in the global namespace registry of this repository.

        Assigning a new prefix to a URI that already exists in the namespace registry erases the old prefix. In general this can almost always be done, though an implementation is free to prevent particular remappings by throwing a NamespaceException.

        On the other hand, taking a prefix that is already assigned to a URI and re-assigning it to a new URI in effect unregisters that URI. Therefore, the same restrictions apply to this operation as to NamespaceRegistry.unregisterNamespace.

        Specified by:
        registerNamespace in interface NamespaceRegistry
        Overrides:
        registerNamespace in class ReadOnlyNamespaceRegistry
        Parameters:
        prefix - The prefix to be mapped.
        uri - The URI to be mapped.
        Throws:
        NamespaceException - If an attempt is made to re-assign a built-in prefix to a new URI or, to register a namespace with a prefix that begins with the characters "xml" (in any combination of case) or, An attempt is made to perform a prefix re-assignment that is forbidden for implementation-specific reasons.
        UnsupportedRepositoryOperationException - if this repository does not support namespace registry changes.
        AccessDeniedException - if the current session does not have sufficent access to register the namespace.
        RepositoryException - if another error occurs.