How to get custom attribute value from an XMPP XML message?

前端 未结 3 1867
梦如初夏
梦如初夏 2021-01-05 11:30

Ok guys, simple question but pretty important to me.

so, other android client are sending this xml msg:



        
3条回答
  •  春和景丽
    2021-01-05 12:32

    There exists another way to get attribute value, which defines the method UserInfo4XMPP by implementing ExtensionElement:

    import org.jivesoftware.smack.packet.ExtensionElement;
    public class UserInfo4XMPP implements ExtensionElement{
        public static final String NAMESPACE = "urn:xmpp:receipts";
        private String elementName = "received ";
        private String id = "";    
        @Override
        public String getElementName() {
            return elementName;
        }
            @Override
        public CharSequence toXML() {  
            return "";
        }
        @Override
        public String getNamespace() {
            return NAMESPACE;
        }
        public String getId()
        {
            return id;
        }
    }
    

    The function body is similar to DeliveryReceiptProvider.

提交回复
热议问题