A namespace is a group of related elements that each have a unique name or identifier. There are several different types of namespaces, and each one has a specific syntax used to define the corresponding elements. Each element within a namespace has a "local name" that serves as a unique identifier.
- Domain Names - The namespace syntax for domain names is specified by the Domain Name System, or DNS. It includes the top-level domain, (e.g. "techterms.com") and a subdomain, such as "www." In the URL "www.techterms.com," the namespace identifier is "techterms.com," while the local name is "www."
- File Paths - File locations may be specified using a file path, which can include multiple directories. A file path, which uses syntax defined by the operating system, is considered a namespace. For example, C:\Program Files\Internet Explorer is the namespace that describes where Internet Explorer files on a Windows computer. The namespace /usr/local/apache/ defines the location of Apache files on a Unix-based web server. Individual filenames within these directories serve as unique identifiers.
- XML Documents - XML namespaces (XMLNS) are used to associate a document's element and attribute names with a namespace identified by an external URI. For example, an XML file may include HTML elements that are specified at "http://www.w3.org/1999/xhtml." This reference might appear as "<html:html xmlns:html='http://www.w3.org/1999/xhtml'>" near the top of the XML document.
The above examples are just a few types of namespaces used in computing. They are also used to define network devices and other types of computer hardware. Additionally, computer programmers often used namespaces to group related variables within the source code of a program. While there are many different types of namespaces, they all serve the same purpose — to contain a logical grouping of related elements.
Updated: April 25, 2013