XML 使用 HTTPS 的命名空间 URI?

XML Namespace URI with HTTPS?

使用 https 协议的 xmlns URI 是否更好?

例如,这是手册推荐的方式:

<http xmlns="http://www.springframework.org/schema/security"/>

这样使用合法且更好吗?

<http xmlns="https://www.springframework.org/schema/security"/>
  1. 是否有 XML 解析器尝试连接到由 xmlns URI 定义的地址?
  2. 解析器总是通过 xsi:schemaLocation 属性下载模式?

URI 是命名空间名称,它标识 命名空间。

而对于某些 URI 方案(如 httphttpsftp 等),可以提供架构(或其他相关信息) , 这是 "not a goal":

It is not a goal that it be directly usable for retrieval of a schema (if any exists).

(大多数 URI 方案不允许这样开头,例如 urntagjabber 等)

您应该完全按照记录指定 URI,因为这是消费者期望和寻找的(大多数消费者可能永远不会尝试实际检索 URI),并且 XML Names 1.0 对 comparing URIs

所有这些都将是不同的 命名空间名称,即使它们将解析为相同的 Web 文档:

http://www.springframework.org/schema/security
http://www.Springframework.org/schema/security
httP://www.springframework.org/schema/security
http://www.springframework.org/schema/Security
https://www.springframework.org/schema/security
https://www.springframework.ORG/schema/security