使用HTTPS的XML名称空间URI?

kav*_*i77 23 xml schema uri xml-namespaces xml-parsing

xmlns拥有https协议的URI 更好吗?

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

<http xmlns="http://www.springframework.org/schema/security"/>
Run Code Online (Sandbox Code Playgroud)

使用这种方式是合法的还是更好的?

<http xmlns="https://www.springframework.org/schema/security"/>
Run Code Online (Sandbox Code Playgroud)
  1. 是否有尝试连接到xmlnsURI 定义的地址的XML解析器?
  2. 解析器总是按xsi:schemaLocation属性下载模式?

uno*_*nor 30

URI是名称空间名称,用于标识名称空间.

虽然,在某些URI方案(如的情况下http,https,ftp等),这将是能够提供架构(或其他相关信息),这是"不是目标":

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

(大多数URI方案将不会允许这样的开始,例如urn,tag,jabber等)

您应该完全按照文档指定URI,因为这是消费者期望和寻找的(大多数消费者可能永远不会尝试实际检索URI),而XML Names 1.0对于比较URI非常严格.

所有这些都是不同的命名空间名称,即使它们将解析为同一个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
Run Code Online (Sandbox Code Playgroud)

  • 换句话说,它应该被视为一个不透明的令牌。 (3认同)