An XML namespace is a W3C standard for providing uniquely named elements and attributes in an XML instance. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace then the ambiguity between identically named elements or attributes can be resolved. The World Wide Web Consortium (W3C) is a consortium that produces standards—recommendations, as they call them—for the World Wide Web. ... The Extensible Markup Language (XML) is a W3C-recommended general-purpose markup language for creating special-purpose markup languages (it is a metaformat). ... In general, a namespace is an abstract container, which is or could be filled by names, or technical terms, or words, and these represent (stand for) real-world things. ...
All element names within a namespace must be unique.
A simple example would be to consider an XML instance that contained references to a customer and an ordered product. Both the customer element and the product element could have a child element "ID_number". Refences to the element ID_number would therefore be ambiguous unless the two identically named but semantically different elements were brought under namespaces that would differentiate them.
A namespace is declared using the reserved XML attribute xmlns, the value of which must be a URI (Uniform Resource Identifier) reference e.g. xmlns=http://www.w3.org/TR/REC-html40. The declaration can also include a short prefix with which elements and attributes can be identified e.g. xmlns:html=http://www.w3.org/TR/REC-html40. A Uniform Resource Identifier (URI), is an Internet protocol element consisting of a short string of characters that conform to a certain syntax. ...
An XML namespace does not require that its vocabulary is defined, though it is fairly common practice to place either a DTD or an XML Schema defining the precise data structure at the location of the namespace's URI. A Document Type Definition (DTD for short) is a declaration in an SGML or XML document that specifies constraints on the structure of the document. ... XML Schema, published as a W3C Recommendation in May 2001, is one of several XML schema languages. ...
Stylus Studio XML IDE (http://www.stylusstudio.com/) from Stylus Studio, including XML Namespace 1.0 and 1.1 aware XML editor (http://www.stylusstudio.com/xml_editor.html).
In programming languages, namespaces are scopes that use the enclosing nature of the scope to group logically related identifiers under a single identifier.
Unlike C++, namespaces in Java are not hierarchical as far as the syntax of the language is concerned.
An XMLnamespace does not require that its vocabulary be defined, though it is fairly common practice to place either a DTD or an XML Schema defining the precise data structure at the location of the namespace'sURI.
An XMLnamespace declaration remains in scope for the element on which it is declared and all of its descendants, unless it is overridden or undeclared on one of those descendants (see questions 4.5, 4.6, and 4.8).
This is because the declaration that associates the foo prefix with the http://www.bar.org/ namespace occurs on the B element, overriding the declaration on the A element that associates it with the http://www.foo.org/ namespace.
XMLnamespace declarations that are made on the root element are in scope for all elements and attributes in the document.