Unifying XML namespaces and .NET namespaces

I just want to share how I usually create XML Namespaces.

Let's say I work for a contoso company which has a site at http://www.contoso.com and I'm defining an XML schema in a BizTalk Server 2004. BizTalk Server 2004 will create a .NET Class out of this XSD schema that would live inside my BizTalk Server 2004 project (of course, this can be used in many other cases that just BizTalk Server 2004).
This project could have a namespace of Contoso.Eai.SomeProject then I would use the following XML Namespace for the schema:


URN syntax is defined at http://www.apps.ietf.org/rfc/rfc2141.html. Here are some interesting excerpts:

<URN> ::= "urn:" <NID> ":" <NSS>
where <NID> is the Namespace Identifier, and <NSS> is the Namespace Specific String

The idea is that NID designs who can understand NSS. As NID can only have letters, numbers and -, I use this type of equivalence:

www-contoso-com for www.contoso.com
someone-at-contoso-com for someone@contoso.com. ex.: urn:someone-at-contoso-com:SomeoneCanUnderstandThisPart

Also note that NID is 1 to 31 only character long.

In theory, the NID should be registered, but for a custom development, this type of URN notation can be sufficient. We could consider I use what is described at http://www.w3.org/TR/uri-clarification/#private-unregistered-uri-schemes

I found this way of defining XML namespaces easier than the http://www.contoso.com/Whatever that introduces some confusion between the namespace (which is just ment to be an identifier) and a URL (which is a location).