Skip to Content
0
Former Member
Jul 10, 2008 at 11:42 AM

Copy Nodes

111 Views

Hi,

I am trying to copy nested nodes from a model node into a value node, but my subnodes are not copied anyway.

The structure that should be copied looks like

o context

|-- masternode (0..n)

|------ subnode (0..n)

|------ subnode2 (0..n)

|----


subsubnode (0..n)

they should be copied into nodes having the same structure

o

|-- newnode (0..n)

|------newsubnode (0..n)

|------newsubnode2 (0..n)

|----


subsubnode (0..n)

which means every node can contains several subnodes.

I used WDCopyService.copyElements(masternode, newnode) with the effect that all attributes were copied correctly, but all subnodes were empty.

A way I found was to copy all subnodes manually.

WDCopyService.copyElements(masternode, newnode)

WDCopyService.copyElements(masternode.subnode, newnode.newsubnode)

WDCopyService.copyElements(masternode.subnode2, newnode.newsubnode2)

But this won't copy subsubnode and I have no idea how this should work.

I tried WDCopyService.copySubtree(masternode.subnode2, newnode.newsubnode2) but the subsubnode isn't filled anyway.

Hopefully you unterstand my question and can help me out with some answers.

Thanks in advance

Fabian