cancel
Showing results for 
Search instead for 
Did you mean: 

removeElement() on a recursive node is not working!

raj_balakrishnan3
Participant
0 Kudos

When I try to remove a child of a recursive node, removeElement method always returns false and does not remove the child node. What am I doing wrong?

Please see code below

IPrivateFirecallSetup.IFirecallConfigurationElement roleElement = wdContext.currentFirecallConfigurationElement();

IPrivateFirecallSetup.IFirecallConfigurationElement userElement = roleElement.currentChildNodeElement();

wdContext.nodeFirecallConfiguration().clearSelection();

boolean removeResult = wdContext.nodeFirecallConfiguration().removeElement(userElement);

Thanks,

Raj Balakrishnan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Raj,

Hint: node.removeElement(el) works if and only if el is element of node, i.e. el.node() == node. You are breaking this rule.

Try this:


IPrivateFirecallSetup.IFirecallConfigurationElement roleElement = wdContext.currentFirecallConfigurationElement();
IPrivateFirecallSetup.IFirecallConfigurationElement userElement = roleElement.currentChildNodeElement();
wdContext.nodeFirecallConfiguration().clearSelection();

boolean removeResult = wdContext.<b>currentFirecallConfigurationElement().nodeChild()</b>.removeElement(userElement);

VS

raj_balakrishnan3
Participant
0 Kudos

Thanks a ton, Valery. That worked!!

Thanks also for your other post on "converting context-tree to xml" (). Maybe you need to put the context-xml code in a weblog.

Thanks again,

Raj Balakrishnan

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Balakrishnan,

Please look at this thread, to see an example, you can check with that.

Thanks,

Raj.