java - Parsing EventElement for XMPP using Smack Library -
can please show me on how parse event pub element , message object following packet. maybe keyword/search term googling not correct i'm not able find helpful while looking documentation or tutorial this.
i have read packetparserutils , xmlpullparser , tried implement it, keep on getting null.
code
eventelement event = groupmessage.getextension("event", "http://jabber.org/protocol/pubsub#event"); try { xmlpullparser parser = packetparserutils.newxmppparser(); log.d(tag, "processstanza event: "+ event.toxml().tostring()); parser.setinput(new stringreader(event.toxml().tostring())); item items = (item) parser.getproperty("items"); log.d(tag, "processstanza: " + items); } catch (xmlpullparserexception e) { e.printstacktrace(); }
<message to='+60174443333@crystal.domain.com/resource' from='9176d3d3-e893-4add-91a1-82b42338c223@group.crystal.domain.com'> <event xmlns='http://jabber.org/protocol/pubsub#event'> <items node='urn:xmpp:mucsub:nodes:messages'> <item id='17100773132085304799'> <message xmlns='jabber:client' lang='en' to='+60174443333@crystal.domain.com' from='9176d3d3-e893-4add-91a1-82b42338c223@group.crystal.domain.com/+60149711089@crystal.domain.com' type='groupchat' id='21d85845-8434-4e0b-bb0c-5768256c5b66'> <body xmlns='jabber:client'>this message</body> </message> </item> </items> </event> </message>
Comments
Post a Comment