getNamespaceURI (NamespaceContext - JavaScript)

Gets the URI for a prefix.

Defined in

NamespaceContext

Syntax

getNamespaceURI(name:string) : string

Parameters Description
name A prefix in the namespace context.
Return value Description
string The matching URI, or null if the prefix does not exist.

Usage

Prefixes are unique in a namespace context.

Examples

This button displays all prefixes and corresponding URIs in a namespace context. The namespace context (sessionScope.ns) and display areas (requestScope.y and requestScope.msg) are global variables defined elsewhere on the page.
if(sessionScope.ns != null) {
	requestScope.y = "Namespaces";
	var p = sessionScope.ns.getPrefixes();
	while(p.hasNext()) {
		var np = p.next();
		requestScope.y = requestScope.y + "\n\t" +
			np + " = " + ns.getNamespaceURI(np);
	}
} else {
	requestScope.msg = "No namespaces";
}