def add_namespace_uri(self, ns_uri, prefix=None, schema_location=None):
        assert ns_uri
        if ns_uri in self.__ns_uri_map:
            ni = self.__lookup_uri(ns_uri)
            new_ni = copy.deepcopy(ni)
            if prefix:
                self.__check_prefix_conflict(ni, prefix)
                new_ni.prefixes.add(prefix)
            self.__merge_schema_locations(new_ni, schema_location)
            for p in new_ni.prefixes:
                self.__prefix_map[p] = new_ni
            self.__ns_uri_map[new_ni.uri] = new_ni
        else:
            if prefix:
                self.__check_prefix_conflict(ns_uri, prefix)
            ni = _NamespaceInfo(ns_uri, prefix, schema_location)
            self.__add_namespaceinfo(ni)