Passing an XML document

Hello everyone.

I am a newbie to the XMPP world, so I apologize in advance if my question seems too trivial. I have a question regarding the following situation: I am using smack as the client and openfire as the server. I am sending a simple IQ message to the server with a particular name space and content. On the server side, I have created and registered a plugin that processes that request and based on some interaction on the server side and the request, it forms an XML document as the response body and sends it back to the client with a particular namesapce. Up to this point it works just fine. What I would like to achieve on the client side is to capture that XML body through a PacketListener without any processing done on that. My question is around the client side: what is the correct approach to this? Do I need to implement and register a new IQProvider on the client side? I tried that and it works but the issue is that in my implementor of the IQProvider, I have access to only an XmlPullParser to parse the response and although I can artificially recreate my XML document through this parser, it is a silly thing to do in my case, I don’t want any processing or parsing at all, I simply want to get the XML document that is in the body back.

What would be the right approach to this problem?

Many thanks,


A minimum processing will be done, because smack needs to decide what to do with that incoming chunk of bytes. But you can get the entire xml with the method “toXML()”, for example:

Packet packet = collector.nextResult();

String xml = packet.toXML();