“xmlns:xmpp” & “xmpp:xmlns”有什么区别?
这个工作正常。
curl -H 'Content-Type: application/xml' -d " <body rid='2965554435' xmlns='http://jabber.o=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh' /> " https://dashboard.onsip.com/http-bind
这个返回一个空响应
curl -H 'Content-Type: application/xml' -d " <body rid='2965554435' xmlns='http://jabber.o=utf-8' ver='1.6' xmpp:version='1.0' xmpp:xmlns='urn:xmpp:xbosh' /> " https://dashboard.onsip.com/http-bind
有什么区别?第二个这样写合适吗?
PS XHR xml是由OXJS库生成的。
This one works Ok.
curl -H 'Content-Type: application/xml' -d " <body rid='2965554435' xmlns='http://jabber.o=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh' /> " https://dashboard.onsip.com/http-bind
this one was returning an empty response
curl -H 'Content-Type: application/xml' -d " <body rid='2965554435' xmlns='http://jabber.o=utf-8' ver='1.6' xmpp:version='1.0' xmpp:xmlns='urn:xmpp:xbosh' /> " https://dashboard.onsip.com/http-bind
what is the difference ? and is the second one is appropriate to write so?
P.S. XHR xml is generated by OXJS library.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Only:
声明一个命名空间。前缀
xmlns:...
在 中具有预定义的含义XML With Namespaces,绑定文档中xmpp:...
前缀的使用。这:
不是命名空间声明,它是一个名为
xmlns
且带有前缀xmpp
的属性。xmpp
前缀未绑定到本文档中的任何命名空间,因为没有xmlns:xmpp
声明,并且它不是预定义的前缀。当 XML With Namespaces 解析器获取
xmpp:...
属性并且没有xmpp
的命名空间声明时,它会抱怨。此错误将是网络服务不给您响应的原因。Only:
declares a namespace. The prefix
xmlns:...
has a predefined meaning in XML With Namespaces, to bind use of thexmpp:...
prefix in the document.This:
is not a namespace declaration, it's an attribute named
xmlns
with the prefixxmpp
. Thexmpp
prefix is not bound to any namespace in this document because there is noxmlns:xmpp
declaration and it is not a predefined prefix.An XML With Namespaces parser will complain when it gets
xmpp:...
attributes and there is no namespace declaration forxmpp
. This error will be why the web service is giving you no response.