为什么 XML 命名空间通常以 http://... 开头? [英] Why do XML Namespaces usually start with http://...?

查看:31
本文介绍了为什么 XML 命名空间通常以 http://... 开头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,WPF 命名空间是:

For example, the WPF namespace is:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

如果我定义自己的命名空间,是否也应该以http开头?http 不是误导吗?

If I define my own namespace, should it also start with http? Isn't http misleading?

推荐答案

W3C 文档定义 XML 命名空间 说(引用):

定义:XML 命名空间是由 URI 引用标识[RFC3986]

Definition: An XML namespace is identified by a URI reference [RFC3986]

RFC 3986 说(引用):

1.1.1.通用语法

每个 URI 都以方案名称开头,如第 3.1 节中所定义,
指的是一个规范在其中分配标识符
方案.

Each URI begins with a scheme name, as defined in Section 3.1, that
refers to a specification for assigning identifiers within that
scheme.

所以我猜使用 http://是最接近标准的方法——因为 HTTP 是网络上最常用的方案.

So I guess using http:// is what's closest to the standard -- as HTTP is the most common scheme used on the net.

此外,由于域名只能有一个所有者,因此它允许每个公司在其命名空间中使用其 URL.

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.

这篇关于为什么 XML 命名空间通常以 http://... 开头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆