powered by Jive Software

Smack stripping contents of IQ packets


I’‘m working with data forms, JEP-0004. I can send my form request "<iq type=’‘get’’><command node=’‘mynode’’ action=’‘execute’’>" to my remote client. The client responds correctly, I can see that it sends the form, the smack debug ‘‘Raw Received Packets’’ shows receiption of the form. However, my packet listener receives the iq packet with element stripped out.

From smack “Raw Received Packets”

<iq to=’‘holla@t/XMPPTestApp’’ type=’‘result’’ id=’‘ouX3z-6’’ from=’‘gate@t/gate’’>

<command xmlns=’‘http://jabber.org/protocol/commands’’ node=’’/Gate/Setting/GateWidth’’ status=’‘executing’’>

<x xmlns=’‘jabber:x:data’’ type=’‘form’’>

Gate Width

<field var=’‘GateWidth’’ type=’‘text-single’’ label=’‘Gate Widht’’>


What my packet listener receives is

You can see that the id’'s match but the element has been removed.

The stripping occurs with both a FromContainsFilter and my custom filter

allPacketsFilter = new PacketFilter() {

public boolean accept(Packet packet) {

return true;


Can someone please tell me what’'s going on here? Or tell me how to get smack to return IQ packets without any processing.




Smack doesn’'t use a full XML document model (like DOM) to model XMPP packets. That means that any packet extensions need specific parsing code. Please see the documentation on writing IQ providers and packet extension providers for info about this.

There also an open issue to create some generic IQ parsing code that would at least store the extra info in a String for later XML parsing, but I think a provider is what you need in this case.




I just figured that if I set up a allpacketsfilter that my filter would redirect that packet to me before additional parsing. But from your reply, I guess smack does more work before it applies the filters. In the case of forms, stripping out elements it doesn’‘t know about. I’'ll look in IQ providers.