为什么 URL 在 XML 命名空间中?

为什么 URL 在 XML 命名空间中?

问题描述:

以这一行为例:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</configuration>

一些简短的研究告诉我,没有必要在该 URL 上托管任何内容.因此,如果它只是对包含在本地程序集中的命名空间的引用,为什么要使用 URL 而不是像 .NET 通常使用的常规命名空间(例如 System.Data)?

Some brief research has taught me that nothing necessarily has to be hosted at that URL. Therefore, if it's just a reference to a namespace contained in a local assembly, why use URLs instead of regular namespaces like the ones typically used by .NET (System.Data, for example)?

这只是一个约定.URI(即它们的本质,而不是真正的 URL)是一种方便且全球通用的识别资源的方式.另一方面,.NET 样式的标识符对于 .NET 开发人员来说是熟悉和可识别的 - XML 比 .NET 更重要.

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.