Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

PubSub: Appending a Node to a CollectionNode (aSmack)

$
0
0

I need to be able to add a Node to an existing Collection of Nodes at runtime. I have found I can do the following:

 

Node myNode = mgr.getNode("BuzzPacks");

ConfigureForm existingConfig = myNode.getNodeConfiguration();

ConfigureForm newConfig = new ConfigureForm(existingConfig.createAnswerForm());

Iterator coll = existingConfig.getChildren();

List copy = new ArrayList();

while (coll.hasNext())

     copy.add(coll.next());

copy.add("BuzzPack3");

newConfig.setChildren(copy);

myNode.sendConfigurationForm(newConfig);

 

but if I do it this way, the 'name' is blank:

 

<iq type="result" id="4wkUg-4" from="pubsub.SERVER_ADDRESS" to="bob@SERVER_ADDRESS/Smack01">

  <query xmlns="http://jabber.org/protocol/disco#items" node="BuzzPacks">

    <item jid="pubsub.SERVER_ADDRESS" name="" node="BuzzPack3"/>

    <item jid="pubsub.SERVER_ADDRESS" name="BuzzPack2" node="BuzzPack2"/>

    <item jid="pubsub.SERVER_ADDRESS" name="BuzzPack1" node="BuzzPack1"/>

  </query>

</iq>

 

I'm assuming there is a better way to do this, can anyone point me in the right direction?


Viewing all articles
Browse latest Browse all 4979

Trending Articles