为 XML 命名空间前缀使用不同的名称是否重要? [英] Does having a different name for the XML namespace prefix matter?

查看:25
本文介绍了为 XML 命名空间前缀使用不同的名称是否重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说,我正在更改应用程序的网络服务器容器.旧容器将如下发回 SOAP 响应:

Long story short, I'm changing the web-server container for an application. The old container would send back SOAP responses as follows:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      ... other elements ...
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

在新服务器中,我可以发回以下响应:

In the new server, I'm able to send back the following responses:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     ... other elements ...
   </soap:Body>
</soap:Envelope>

如您所见,唯一不同的是使用的命名空间前缀(SOAP-ENVsoap).对于可能依赖这些网络服务的所有客户端,我并不透明,但是这两个 XML 响应相同吗?任何客户端是否会因为看到(简单地)根信封和正文标签的不同命名空间前缀而中断,即使它们最终指向相同的 URI?

As you can see, the only thing different is the namespace prefix used (SOAP-ENV versus soap). I do not have transparency on all the clients who could be dependent on these web-services, but are the two XML responses identical? Could any client break as a result of seeing (simply) a different namespace prefix for the root Envelope and Body tags, even if they ultimately point to the same URI?

推荐答案

不,除了它们与命名空间值的绑定之外,命名空间前缀名称无关紧要.

某些编写不当的软件可能会对 XML 命名空间前缀有不当的依赖.但是,根据广泛采用的 W3C 标准,名称空间前缀名称只能通过它们与名称空间值的绑定来获得含义.除了那个绑定之外,它们是微不足道的.

It is possible that some poorly-written software will have an improper dependency on an XML namespace prefix. However, per well-adopted W3C standards, namespace prefix names only derive meaning through their binding to a namespace value. They are insignificant apart from that binding.

没有符合标准的 XML 处理器将依赖于特定的命名空间前缀名称本身.

No conformant XML processor will depend upon the specific namespace prefix name itself.

这篇关于为 XML 命名空间前缀使用不同的名称是否重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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