on 12-30-2005 1:15 PM
I want to create node within a node in the context of component controller. Now in the doInit method of the Component Controller I want to populate the node structure. How to do that? because in the parent node I can populate its attribute but there is no setter method for the child node , by which I can set the child to the parent node. can anybody help me ..
I have tried by using the setAttribute method of the parent to add the child. for that two parameter I have passed one are child node name and the other one is the child node object(populated one)
rgds,
Soumen
Hi Soumen,
When we create the node itself, we need to associate it with the parent node. The following lines of code will help you to create a node(singleton, 1..1 cardinality) under a parent node:
Assumptions for the following code are:
1) The name of the parent node is 'parent_node'.
2) The cardinality of 'parent_node' is 1..1 or 1..n. If you set the cardinality starting from zero, you need to explicitly create an element and then set the leadselection before using this code.
IWDNodeInfo NodeInfo = wdContext.nodeParent_node().getNodeInfo().addChild("child_node",null,true,true,false,false,false,true,null,null,null);
IWDAttributeInfo info = NodeInfo.addAttribute("child_Attribute" , "ddic:com.sap.dictionary.string");
wdContext.nodeParent_node().getChildNode("child_node",wdContext.nodeParent_node().getLeadSelection()).getCurrentElement().setAttributeValue("child_Attribute","Test Value");
wdComponentAPI.getMessageManager().reportSuccess(" The value set is ::"+wdContext.nodeParent_node().getChildNode("child_node",wdContext.nodeParent_node().getLeadSelection()).getCurrentElement().getAttributeValue("child_Attribute"));
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the child node a singleton or non-singleton?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.