xmlel elements in Packet

Hello everyone,
I'm creating an messenger app with ejabberd, so far everything was great until we got to push notifications.
I've managed to post the message to an url, but still we need to differentiate between android and IOS, and so here is where the problem appears. I'm using a module to intercept the messages, but I cant extract my custom xmlel inside the Packet. Here is my state so far:

Packet returns to me:
{message,<<>>,chat,<<"en">>,{jid,<<"26">>,<<"localhost">>,<<"3199817459420844096738">>,<<"26">>,<<"localhost">>,<<"3199817459420844096738">>},{jid,<<"23">>,<<"localhost">>,<<>>,<<"23">>,<<"localhost">>,<<>>},[],[{text,<<>>,<<"H">>}],undefined,[{xmlel,<<"senderHash">>,[],[{xmlcdata,<<"0">>}]},{xmlel,<<"typeDevice">>,[],[{xmlcdata,<<"Android">>}]}],#{ip => {172,31,14,53}}}

Packet#message.sub_els returns to me:
[{xmlel,<<"senderHash">>,[],[{xmlcdata,<<"0">>}]},{xmlel,<<"typeDevice">>,[],[{xmlcdata,<<"Android">>}]}]

I'v tried fxml:get_attr_s(), fxml:get_subtag(), fxml:get_tag_attr() on both Packet and Packet#message.sub_els to extract the xmlcdata, but so far none of this has worked. I just need to extract that xmlcdata information from typeDevice, does anyone knows how to get that? I cant find this info anywhere. Thanks in advance

Here is the function in customizing:

create_message({Action, Packet} = Acc) when (Packet#message.type == chat) and (Packet#message.body /= []) ->
[{text, _, Body}] = Packet#message.body,
Sub = Packet#message.sub_els,

?INFO_MSG("MSG: ~p ", [Packet]),
?INFO_MSG("VERY FORESTS OF LOARDERON ~p", [Sub]),

typeDevice = fxml:get_attr_s(<<"typeDevice">>, Sub),
?INFO_MSG("xmlel data ~p", [typeDevice]),

post_offline_message(Packet#message.from, Packet#message.to, Body, Packet#message.id),
Acc;

What about

What about fxml:get_subtag_cdata(Packet#message.sub_els, <<"typeDevice">>)

Syndicate content