问题
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