on 01-15-2008 10:44 AM
Dear All,
I am facing one problem, I have two model node. I want to copy one model node to other model node.while copying its giving error saying the you can bind the element, coz target node doesn't have valid parent.
Pl don't suggest me work on Value node.
Can i create a element in model node at run time.
Thanks & Regards
Manoj Sahoo
Just clone the model object of node 1 then bind it to node 2. If you get an error because parent of node 2 is not valid you will have to create a suitable model object for it (containing the cloned object before mentioned, probably thanks to the use of an add or set method with the cloned object as parameter) and make a bind.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have solved this problem by creating dummy object for both request node and response node and bind them. This will create a dummy element for me , after that i can copy the node with out any error.
Thanks to all of you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi manoj,
It seems the node u r trying to copy is a child node & no element exists for the parent node. Execute the model, so that ur parent node is filled. After that u can copy the node.
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manoj,
Model node properties :
1.A context model node makes a model object look like any other context node. I.E. it gives the model object an API that is very similar to a value node.
2. A model node is not considered valid until it is bound to a corresponding model object. Therefore, a model node always inherits its metadata from the model object to which it is bound.
3. The element collection in a model node does not hold the actual runtime data! Instead, it holds a list of references to the relevant model object instances.
If u check the 2nd property, u will find the cause of ur exception. As u have already told, don't suggest to use value nodes, i don't have any other comment.
regards
Sumit
Do this:
Collection objects = (Collection)ANode.modelObject().clone();
BNode.bind(objects);
You will have to implement the clone method by yourself if not implemented by the model object. If you want to just copy the references and not the objects (modifications in one node will be reflected in the other too) just do:
BNode.bind(ANode.modeObject());
Edited by: Eduardo Cabezas López on Jan 22, 2008 4:00 PM
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.