For example, the WPF namespace is: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
If I define my own namespace, should it also start with http? Isn't http misleading?
For example, the WPF namespace is: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
If I define my own namespace, should it also start with http? Isn't http misleading?
From this article at W3Schools:
"The namespace URI is not used by the parser to look up information. The purpose is to give the namespace a unique name. However, often companies use the namespace as a pointer to a web page containing namespace information. Try to go to http://www.w3.org/TR/html4/."
It is a reliable way to create a readable globally unique identifier. It may or may not be to a valid URL with more information.
Another common way instead of using a URL starting with
http://
is to use a Uniform Resource Name whose format is defined by RFC2141.Such namespace identifiers are e.g. used by ODF (OpenDocument Format):
The W3C Document defining XML Namespaces says (quoting) :
And RFC 3986 says (quoting) :
So I guess using http:// is what's closest to the standard -- as HTTP is the most common scheme used on the net.
In addition, as there can be only one owner for a domain name, it allows each company to use it's URL in its namespaces.
Namespaces doesn't have any meaning in their value, except for that value to be unique to avoid nameclashing. This is why you see a lot of companies putting in the URL for their own website as the namespace. URLs serve the same purpose, to be unique. Over the years it's just become good practice to use an URL, because if everyone does that, no nameclashing should occur :)