在smack消息中添加不带名称空间的元素 [英] Add element without namespace in smack message

查看:49
本文介绍了在smack消息中添加不带名称空间的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在smack消息中添加节点元素.

I wants to add node element in smack Message .

例如.< myID> 是我要在消息中添加的自定义标签.像下面的结构

Eg. <myID> is the custom tag which i wants to add in message. like below structure

<message to='username@domain' id='12345'><body>Hello</body><myID>33e6cf03-90aa-4281-a36e-902ccdf0657f</myID></message>

到目前为止,我通过尝试实现CustomExtension /packet/DefaultExtensionElement.html"rel =" nofollow noreferrer> DefaultExtensionElement ,但此处是指定了某些命名空间的创建消息.

What i tried so far By creating CustomExtension by implementing DefaultExtensionElement but here its creating message with some namespace specified.

<message to='username@domain' id='12345'><body>Hello</body><myID xmlns='somenamespace'>33e6cf03-90aa-4281-a36e-902ccdf0657f</myID></message>

但是我想添加不包含名称空间作为元素.

But i wants to add without namespace as a element.

有帮助吗?

我检查了已经回答过的问题,但都带有名称空间.

推荐答案

XMPP希望您使用名称空间来限定自定义扩展.这就是Smack无法轻松解决该要求的原因.

XMPP expects you to qualify custom extensions with a namespace. That's why Smack doesn't make it easy to work around that requirement.

这篇关于在smack消息中添加不带名称空间的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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