【问题标题】:XML Namespace URI with HTTPS?带有 HTTPS 的 XML 命名空间 URI?
【发布时间】:2015-08-22 19:53:34
【问题描述】:

拥有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 属性下载模式?

【问题讨论】:

    标签: xml xml-parsing schema uri xml-namespaces


    【解决方案1】:

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

    虽然在某些 URI 方案(如 httphttpsftp 等)的情况下,可以提供架构(或其他相关信息),这是"not a goal":

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

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

    您应该完全按照文档说明指定 URI,因为这是消费者期望和寻找的(大多数消费者可能从未尝试实际检索 URI),并且 XML 名称 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
    

    【讨论】:

    • 换句话说,它应该被认为是一个不透明的令牌。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-30
    • 2011-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多