Hi,
I’m trying to send a custom IQ Packet but I don’t know how to fill the XML into a IQ Packet object…
This is my code :
private void sendCustomPacket(JID from) {
final IQ iq = new IQ();
String output = "<pubsub xmlns='http://jabber.org/protocol/pubsub'>";
output += "<publish node='http://jabber.org/protocol/profile'>";
output += "<item>";
output += "<custom xml:lang='en'>";
output += "<attribute1>1001</attribute1>";
output += "<attribute2>2002</attribute2>";
output += "</custom>";
output += "</item>";
output += "</publish>";
output += "</pubsub>";
iq.setChildElement(output); iq.setType(IQ.Type.result);
iq.setTo(from); // Here I need to fill the 'iq' object with the xml string from 'output'... ?! XMPPServer.getInstance().getPacketRouter().route(iq);
Log.info("Log: XMPPServer.getInstance().getPacketRouter().route(iq)");
}
Is there any best ways to something like that ?