powered by Jive Software

PubSub: Appending a Node to a CollectionNode (aSmack)

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:

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