on 02-09-2007 2:47 PM
Hi all,
I need to copy my value node to a model node but using
WDCopyService.copySubtree((IWDNode)ValueNode,(IWDNode)ModelNode);
I get the exception "Nodes are incompatible" even if they have the same structure.
Any helps?
Stefano
Copyingd data from value node to model node is not possible because model node holds reference whose information is not there in value node.
What u can do
1>u can iterate over value node.
2>Get the reference of parent model node.
3>Add objects of child model node to the parent model node.
4>Copy values wusing copy corresponding method.
<Parent Model Node's class> input = new <Parent Model Node's class>();
wdContext.node<Parent Model Node>().bind(input);
int size=wdContext.node<value node>().size();
for(int i=0;i<size;i++)
{
IWDNode el=wdContext.node<value node>().getElementAt(i);
input.add<ChildNode>(new <ChildNodeModelClass>());
wdContext.node<ChildNode>.moveLast();
wdCopyservice.copyCorresponding(el,wdContext.current<ChildModelNode>);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gopi,
the thread you suggest talks about copying ModelNode to ValueNode that for me works well.
In my application I get data from a model and I transfer these data using:
WDCopyService.copySubtree((IWDNode)myModelGetDataNode,(IWDNode)myValueNode);
Then the user can change these data and I need to re-transfer them to the save model:
WDCopyService.copySubtree((IWDNode)myValueNode,(IWDNode)myModelSaveDataNode);
This second step doesn't work and it raise the exception "Nodes are incompatible".
The structure used by the 2 Model are identical.
Thank u again,
Stefano
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.