在 smack 消息中添加没有命名空间的元素

Add element without namespace in smack message

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

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

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

到目前为止我尝试了什么 通过实现 DefaultExtensionElement 创建 CustomExtension 但这里它的创建消息指定了一些命名空间。

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

但我想添加 没有 命名空间作为元素。

有什么帮助吗?

我检查了已经提出和回答的问题,但所有问题都带有命名空间。

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