Returns the URI of prefix (if any)

@param prefix the prefix whose URI is searched for
@return the namespace URI currently associated with the
prefix, null if the prefix is undefined.
335747
public String getNamespaceURIFromPrefix(String prefix)
    {
        String uri = null;
        if (m_prefixMap != null)
            uri = m_prefixMap.lookupNamespace(prefix);
        return uri;
    }
843389
@Override
  public String getNamespaceURI(String prefix) {
    // per javax.xml.namespace.NamespaceContext doc
    if (prefix == null)
      throw new IllegalArgumentException("Cannot get namespace URI for null prefix");
    if (XMLConstants.XML_NS_PREFIX.equals(prefix))
      return XMLConstants.XML_NS_URI;
    if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
      return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;

    String namespaceURI = bindings.get(prefix);

    // per javax.xml.namespace.NamespaceContext doc
    return (namespaceURI != null) ? namespaceURI : XMLConstants.NULL_NS_URI;
  }
319933
private String getURI(Map<String, Object> props) {
        if (props == null)
            return null;
        if (props.keySet().contains(URI)) {
            return (props.get(URI).toString());
        } else {
            return null;
        }
    }
65301
function(uri) {
        var prefix = null;
        if(uri == null) {
            prefix = this.namespaces[this.defaultPrefix];
        } else {
            for(prefix in this.namespaces) {
                if(this.namespaces[prefix] == uri) {
                    break;
                }
            }
        }
        return prefix;
    }
830961
public UnprotectedStringBuffer getNamespaceURI(CharSequence namespacePrefix) {
		for (ElementContext ctx : event.context) {
			for (Pair<UnprotectedStringBuffer, UnprotectedStringBuffer> ns : ctx.namespaces)
				if (ns.getValue1().equals(namespacePrefix))
					return ns.getValue2();
		}
		return new UnprotectedStringBuffer();
	}
107568
public function getNamespaceURI()
	{
		if ( is_null( $this->domNode ) ) return null;
		return is_null( $this->domNode->namespaceURI ) ? "" : $this->domNode->namespaceURI;
	}
747692
public static String getNamespaceURI(Object obj) {

		Package pkg = obj.getClass().getPackage();

		XmlSchema xmlSchemaAnnotation = pkg.getAnnotation(XmlSchema.class);

		return xmlSchemaAnnotation.namespace();
	}
784351
public void registerNamespace(String prefix, String uri)
   {
      try
      {
         namespaceRegistry.getPrefix(uri);
      }
      catch (NamespaceException e)
      {
         try
         {
            namespaceRegistry.registerNamespace(prefix, uri);
         }
         catch (NamespaceException e1)
         {
            throw new RuntimeException(e1);
         }
         catch (RepositoryException e1)
         {
            throw new RuntimeException(e1);
         }
      }
      catch (RepositoryException e)
      {
         throw new RuntimeException(e);
      }

   }
412727
@Override
    public String getURI(int index) {
        if (index < 0 || index >= attributesList.size()) {
            return null;
        }
        return attributesList.get(index).nameSpace;
    }
717185
public String declarePrefix(String uri){
        String prefix = findPrefix(uri);
        if(prefix==null){
            if(uri.isEmpty())
                prefix = ""; // non-empty prefix cannot be used for empty namespace
            else{
                prefix = suggested.getProperty(uri, suggestPrefix);
                if(getURI(prefix)!=null){
                    if(prefix.isEmpty())
                        prefix = "ns";
                    int i = 1;
                    String _prefix;
                    while(true){
                        _prefix = prefix + i;
                        if(getURI(_prefix)==null){
                            prefix = _prefix;
                            break;
                        }
                        i++;
                    }
                }
            }
            declarePrefix(prefix, uri);
        }
        return prefix;
    }
620680
public static function lookupNamespace($prefix)
    {
        return isset(self::$_namespaces[$prefix]) ?
            self::$_namespaces[$prefix] :
            $prefix;
    }
648185
public void addNamespace( String prefix, String uri, String elementName ) {
      if( StringUtils.isBlank( uri ) ){
         return;
      }
      if( prefix == null ){
         prefix = "";
      }
      if( StringUtils.isBlank( elementName ) ){
         rootNamespace.put( prefix.trim(), uri.trim() );
      }else{
         Map nameSpaces = (Map) namespacesPerElement.get( elementName );
         if( nameSpaces == null ){
            nameSpaces = new TreeMap();
            namespacesPerElement.put( elementName, nameSpaces );
         }
         nameSpaces.put( prefix, uri );
      }
   }
824657
@Override
    public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
        if ((defaultNamespace!=null) && (namespaceUri.equals(defaultNamespace))) {
            return "";
        }

        if (namespaceUri.equals(PROV_NS)) {
            return "prov";
        }
        if (namespaceUri.equals(PRINTER_NS)) {
            return "prn";
        }
   //     if (namespaceUri.equals(XSD_NS)) {
   //         return "xsd";
   //     }
        if (namespaceUri.equals(DOMProcessing.XSD_NS_FOR_XML)) { // TODO: TO CHECK that's the one we need
            return "xsd";
        }
        if (namespaceUri.equals(XML_NS)) {
            return "xml";
        }
        if (namespaceUri.equals(XSI_NS)) {
            return "xsi";
        }
        for (String k: nss.keySet()) {
            if (nss.get(k).equals(namespaceUri)) {
                return k;
            }
        }
        return suggestion;
    }
171710
@Nullable
    public static String shortenURI(@Nullable final URI uri) {
        if (uri == null) {
            return null;
        }
        final String prefix = Data.namespaceToPrefix(uri.getNamespace(), Data.getNamespaceMap());
        if (prefix != null) {
            return prefix + ':' + uri.getLocalName();
        }
        final String ns = uri.getNamespace();
        return "&lt;.." + uri.stringValue().substring(ns.length() - 1) + "&gt;";
        // final int index = uri.stringValue().lastIndexOf('/');
        // if (index >= 0) {
        // return "&lt;.." + uri.stringValue().substring(index) + "&gt;";
        // }
        // return "&lt;" + uri.stringValue() + "&gt;";
    }
1224611
private void addNamespace(String prefix, String uri) {
        prefixToURI.put(prefix, uri);
        uriToPrefix.put(uri, prefix);
    }
648963
def find_namespace_uri(ns_stack, prefix, uri_check=nil)
      tns = ns_stack.reverse.find{|ns| ns.has_key?(prefix)}
      uri = tns[prefix] if tns
      raise "prefix: '#{prefix}' is bound to uri: '#{uri}', but should be '#{uri_check}'" if uri_check && uri && uri!=uri_check
      uri
    end
242595
public long getRequstURIPath(String prefix, long defvalue) {
        String val = getRequstURIPath(prefix, null);
        try {
            return val == null ? defvalue : Long.parseLong(val);
        } catch (NumberFormatException e) {
            return defvalue;
        }
    }