使用HTTPS的XML命名空间URI?

37

在使用xmlns URI时,是否最好使用https协议?

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

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

这种方式合法且更好吗?
<http xmlns="https://www.springframework.org/schema/security"/>
  1. 是否有XML解析器尝试连接由xmlns URI定义的地址?
  2. 解析器总是通过xsi:schemaLocation属性下载模式吗?
1个回答

48

URI是命名空间名称,用于标识命名空间。

尽管在某些URI方案(如httphttpsftp等)的情况下,可以提供方案(或其他相关信息),但这不是一个“目标”

直接用于检索模式(如果存在)不是目标。

(大多数URI方案本来就不允许这样做,例如urntagjabber等)

您应该按照文档精确指定URI,因为这是消费者期望并寻找的内容(大多数消费者可能从未尝试实际检索URI),而XML Names 1.0非常严格地比较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

3
换句话说,它应被视为一个不透明的标记。 - BenGoldberg

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接