我有一个这样的小包:
[{message,<<"1529424074151_7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>,chat,<<"en">>,{jid,<<"testuser">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>,<<"testuser">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>},{jid,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>},[],[{text,<<>>,<<"H\nJ\nK\nL">>}],undefined,[{mam_archived,{jid,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>},<<"1529424074316547">>},{stanza_id,{jid,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>},<<"1529424074316547">>},{xmlel,<<"message_format">>,[],[{xmlel,<<"messageId">>,[],[{xmlcdata,<<"1529424074151_7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>}]},{xmlel,<<"messageTime">>,[],[{xmlcdata,<<"1529424074151">>}]}]},{xmlel,<<"markable">>,[{<<"xmlns">>,<<"urn:xmpp:chat-markers:0">>}],[]}],#{ip => {10,100,66,249},mam_archived => true,stanza_id => 1529424074316547}}]
我想在其中获取“格式”的值:
{xmlel,<<"format">>,[],[{xmlcdata,<<"sms">>}]},
所以这里是“ sms”
有人可以告诉我如何使用fxml和ejabberd 18.04获得此值。 现在我正在尝试:
Temp_format = fxml:get_subtag(Pkt, <<"message_format">>),
和:
fxml:get_path_s(Packet, [{elem, "message_format"}])
但是两者都给我错误:
** Reason = {error,function_clause,[{fxml,get_subtag,[{file,"src/fxml.erl"},{line,175}],