NamespaceContextImpl (JavaScript)

Manipulates a namespace context.

Defined in

DOM (JavaScript)

Constructors

Method Description
NamespaceContextImpl() Creates a namespace context.

Methods

This class inherits the methods of NamespaceContext (JavaScript). Other methods are in addition.

Usage

The name and prefix form a namespace. The namespace is added if the prefix does not already exist in the namespace context. If the prefix already exists, this namespace replaces the existing namespace.

Examples

This button onclick event creates a namespace context if it does not yet exist then adds or replaces a namespace. The prefix and URI for the namespace are global objects defined elsewhere on the page before the button is clicked. The namespace context is a global object so other code can use it.
if(sessionScope.ns == null) {
	sessionScope.ns = new NamespaceContextImpl();
}
sessionScope.ns.addNamespace(
	requestScope.prefix, requestScope.uri);