Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Stophe在XML消息中添加元素_Javascript_Xml_Xmpp_Strophe - Fatal编程技术网

Javascript 如何使用Stophe在XML消息中添加元素

Javascript 如何使用Stophe在XML消息中添加元素,javascript,xml,xmpp,strophe,Javascript,Xml,Xmpp,Strophe,我正在使用 我想在messagexml标记中添加元素 Strophe链接: 我的代码是: connection.sendIQ($iq({type: "get"}).c("query", {xmlns: Strophe.NS.ROSTER}).tree(), onRoster); connection.send( $msg( { to:"user1@rtm.umobility

我正在使用

我想在messagexml标记中添加元素

Strophe链接:

我的代码是:

connection.sendIQ($iq({type: "get"}).c("query", {xmlns: Strophe.NS.ROSTER}).tree(), onRoster);
connection.send(
                $msg(
                      {
                        to:"user1@rtm.umobility.bizrtc/primea",
                        id:"user2_1564828681632",
                        from:"user2@rtm.umobility.bizrtc/primea",
                      }
                   )

                );
这将生成以下XML:

<message from="user2@rtm.umobility.bizrtc/primea" id="user2_1564828681632" to="user1@rtm.umobility.bizrtc/primea" xmlns="jabber:client"/>

我需要这样的东西:

<message xmlns:cli="jabber:client" to="cinu@rtm.umobility.bizrtc" cli:subject="TEXT MESSAGE" cli:lang="en" type="chat" id="rajan_1564637142811" from="rajan@rtm.umobility.bizrtc/primea"><body>Some XMPP Message</body><request xmlns="urn:xmpp:receipts"></request></message>
一些XMPP消息
在上面的XML中,它在
标记内有
标记。我该怎么做?我想用Stophe JS做这件事。发送XMPP消息