Even though namespace URIs are not real resources available over HTTP, what is the purpose of XML namespaces? And how are XML parsers related to it? Where their recognition (nam
The purpose of XML namespaces is explained clearly in Section 1, Motivation and Summary of the W3C Recommendation: Namespaces in XML 1.0 (Third Edition):
We envision applications of Extensible Markup Language (XML) where a single XML document may contain elements and attributes (here referred to as a "markup vocabulary") that are defined for and used by multiple software modules. One motivation for this is modularity: if such a markup vocabulary exists which is well-understood and for which there is useful software available, it is better to re-use this markup rather than re-invent it.
Such documents, containing multiple markup vocabularies, pose problems of recognition and collision. Software modules need to be able to recognize the elements and attributes which they are designed to process, even in the face of "collisions" occurring when markup intended for some other software package uses the same element name or attribute name.
These considerations require that document constructs should have names constructed so as to avoid clashes between names from different markup vocabularies. This specification describes a mechanism, XML namespaces, which accomplishes this by assigning expanded names to elements and attributes.
An XML namespace takes the lexical form of a URI, but you are correct that it does not have to be retrievable; per in section 3, Declaring Namespaces:
The attribute's normalized value MUST be either a URI reference — the namespace name identifying the namespace — or an empty string. The namespace name, to serve its intended purpose, SHOULD have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists).
A primary benefit of using a URL is that the domain name holder can be considered to be authorized to manage the unique use of the domain in defining the namespace.
Parsers consider namespaces URIs to be lexical parts of component (element and attribute) names. Parsers also use namespaces in xsi:schemaLocation
to help locate the XSD to associate with an XML file per user "hints".
The answer to the question in your title is:
Namespace names are strongly encouraged to be URIs, though most software interprets the specs as permitting any character string.
URIs can be HTTP "addresses", but they don't have to be.
Some of those who advocate using HTTP addresses as namespace URIs believe that it's a good idea because you can then put human-readable or machine-readable information about the namespace at that address. (W3C does this for W3C-defined namespaces, for example)
However, the use of HTTP addresses as namespace URIs has certainly caused an immense amount of confusion, and some people think it is better to use something that looks more like an identifier and less like the address of a resource.