XMPP asmack problem missing attribute
I encountered a problem where an attribute within an XML stanza is missing. Based on the log file on the server side, I can confirm that the attribute is sent from the client to server. Also, when the server deliver the XML stanza to the recipient, the attribute is also there (still, based on the开发者_如何学JAVA log file on the server side). The problem is, when the XML stanza received on the recipient's part, the attribute is not detected. Is there any idea what might causes this?
Original XML Stanza (sent to server, delivered to client, shown on the log):
<message id="RquuK-35"
to="dodol@master.nze.com"
from="lola@master.nze.com">
<body>Let's join in my group!!</body>
<x xmlns="jabber:x:conference" jid="8c326c93b43077d4ecef8685de686462@conference.master.nze.com"/>
</message>
Received XML Stanza:
<message id="RquuK-35"
to="dodol@master.nze.com"
from="lola@master.nze.com">
<body>Let's join in my group!!</body>
<x xmlns="jabber:x:conference"/>
</message>
Any constructive input is greatly appreciated. Thank you.
It's possible that when you're requesting the jid
attribute from the XML DOM, you're specifying a namespace of jabber:x:conference
. However, unprefixed attributes are always without namespace. Try using ""
as the namespace URI.
You need to implement a custom PacketExtensionProvider
to properly parse the XML packet.
Then add it to the ProviderManager using ProviderManager.getInstance().addExtensionProvider("myElementName", "myNamespace", new MyCustomPacketExtensionProvider());
精彩评论