How to extract data from xml on ejabberd server?

て烟熏妆下的殇ゞ 提交于 2021-02-11 15:48:50

问题


I am using custom module to view data of every coming packet on the ejabberd server. My log print on the terminal is given below:

18:30:06.370 [info] mod_stanza_ack a presence has been sent coming from: {jid,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<"2923451306214954478930">>,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<"2923451306214954478930">>}
18:30:06.371 [info] mod_stanza_ack a presence has been sent to: {jid,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<>>,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<>>}
18:30:06.372 [info] mod_stanza_ack a presence has been sent with the following packet:
 {presence,<<"IaOQN-29">>,unavailable,<<"en">>,{jid,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<"2923451306214954478930">>,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<"2923451306214954478930">>},{jid,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<>>,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<>>},undefined,[],undefined,[],#{ip => {0,0,0,0,0,65535,49320,422}}}

how can I extract data from xml format using specific tags like: from first and second line: jid.


回答1:


Using https://github.com/processone/xmpp#stanzas

There's plenty of example code in... ejabberd source code :P



来源:https://stackoverflow.com/questions/63524524/how-to-extract-data-from-xml-on-ejabberd-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!