I have a child element called Request inside my message element of xmpp packet. Therefore, my packet looks like the below:
<message to="b" from="a" type="chat">
<request xmlns="urn:client:send-ack"></request>
</message>
I want to match the value of xmlns attribute inside the request element. So I want to do something like
case xml:get_attr_s(<<"xmlns">>, xml_get_subtag(<<Request>>,Packet)) of
"urn:client:send-receipts" ->
%% Do something
ok.
But, obviously this densest work. Whats the best way to do it ?
xml
module, thenxml:get_tag_attr(<<"xmlns">>, xml:get_subtag(El, <<"request">>))
is the way to go, but (arguably)exml_query:path/2
, suggested by Piotr, has a more convenient interface. – erszcz