Hello,
Fairly new to the XMPP scene, currently playing around with the Smack library along with the su-smack pubsub libraries and I’ve run into a problem I can’t seem to figure out yet, and it seems like it should be something fairly obvious that I’m overlooking.
I’m trying to do some simple operations with pubsub, like create, view, edit, update, delete nodes. The problem I’m running into is being able to set the xmlns on a pubsub tag when attempting to delete a node. The delete isn’t working, but that’s another story, and I’m pretty sure I need to get this step working first before the delete operation is successful. Here’s an example Java code, followed by the generated XML:
XMPPConnection con = new XMPPConnection("localhost");
con.connect(); con.login("username","password");
con.addPacketListener(new PacketListener(){
public void processPacket(Packet pack) {
System.err.println("Recv : "+ pack.toXML()); }
},null); PubSub.setDefaultXmlns("http://jabber.org/protocol/pubsub#owner");
PubSub pubsub = new PubSub(); pubsub.setTo("pubsub.myopenfireservername");
pubsub.setType(IQ.Type.SET); // Check if the xmlns was set correctly
System.out.println("xmlns: " + pubsub.getXmlns()); DeleteElement de = new DeleteElement("node");
pubsub.addChild(de); System.out.println("Send : " + pubsub.toXML());
con.sendPacket(pubsub);
Thread.sleep(5000);
con.disconnect();
The System.out for the xmlns prints what I would expect:
xmlns: http://jabber.org/protocol/pubsub#owner
However, the System.out for the pubsub message looks like this:
<iq id="J6nJW-4" to="pubsub.myopenfireservername" type="set">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<delete node="node"></delete>
</pubsub>
</iq>
Now, my question is: Why is the xmlns on the pubsub tag not what I set it too?
Any guidance or suggestions here would awesome.