Why are URLs in XML namespaces?

Solution 1:

When you ask why a standard is the way it is, there are two possible interpretations of your question: (a) what are the perceived benefits of the design choice that was made, and (b) what was the historical sequence of events that led to this design being adopted over other designs.

Clearly, using HTTP-like URIs gives uniqueness. But that could also have been achieved in other ways, for example by inventing a new URI scheme. I think that if you trace the arguments that were made at the time, you will find that many of the people advocating the use of HTTP-style URIs were also advocating that namespace URIs should be dereferencable, perhaps to a schema or to some other kind of document. Indeed, it's W3C policy for its own namespaces that there is always a document that can be retrieved when you type the namespace URI into a browser, and that it should tell you something useful about the namespace.

So I suspect the fact that we use URIs that look deferenceable but don't define any semantics for what happens when they are dereferenced is in fact the result a committee compromise between two or more opposing camps. But you'd have to do some proper historical research to confirm that.

Solution 2:

It's just a convention. URIs (which is what they are, not really URLs) are a convenient and globally-familiar way of identifying resources. On the other hand, .NET-style identifiers are familiar and recognisable to, well, .NET developers - there's rather more to XML than .NET.

Solution 3:

W3 explanation Here

Just like namespaces in .NET, namespaces in XML documents are designed to help prevent and resolve name collisions, especially if XML documents are from different organizations and/or domains of knowledge.

XML document format has been stylized by the same people responsible for HTML, so you may find syntactical similarities in elements of the format. Semantically, the dotNET and XML namespaces serve the same goal.

Solution 4:

The core of the problem is that namespaces have to be URIs. There is no good reason for such a thing since all it needs to be is a unique identifier to give context for the defined elements.

Since they have to be URIs, all possibilities are senseless, because a scheme is needed (e.g. http) even though a namespace has nothing to do with such a thing.

So to answer the question of why: like all bad ideas, someone thought it was a good idea at the time.