code: public void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException
     {
        checkLive();
        NamespaceRegistryImpl nrg = (NamespaceRegistryImpl)workspace.getNamespaceRegistry();
        if (!nrg.isUriRegistered(uri))
        {
           throw new NamespaceException("The specified uri:" + uri + " is not among "
              + "those registered in the NamespaceRegistry");
        }
        if (nrg.isPrefixMaped(prefix))
        {
           throw new NamespaceException("A prefix '" + prefix + "' is currently already mapped to " + nrg.getURI(prefix)
              + " URI persistently in the repository NamespaceRegistry "
              + "and cannot be remapped to a new URI using this method, since this would make any "
              + "content stored using the old URI unreadable.");
        }
        if (namespaces.containsKey(prefix))
        {
           throw new NamespaceException("A prefix '" + prefix + "' is currently already mapped to "
              + namespaces.get(prefix) + " URI transiently within this Session and cannot be "
              + "remapped to a new URI using this method, since this would make any "
              + "content stored using the old URI unreadable.");
        }
        nrg.validateNamespace(prefix, uri);
        namespaces.put(prefix, uri);
        prefixes.put(uri, prefix);
     }
docs: {@inheritDoc}