cancel
Showing results for 
Search instead for 
Did you mean: 

How to instantitate a non-singleton node

former_member220853
Participant
0 Kudos

I need to instantitate the non-singleton node which has the following properties

Collection cardinallity of 0..n

and

Selection Cardinallity of 0..1

But when I try to get this node using wdContext.nodeA().nodeB()

where

nodeA is singleton

nodeB is non-singleton whose properties are given below

I always get nodeB as null . it seems nodes are initialized only if set to singleton

I need non-singleton node for using the TableRowGrouping element

If any one can please help that will be great

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

A non-singleton child node exists for every element of its parent node. Thus you have to specify the parent element:


INodeAElement parent = wdContext.nodeA().getNodeAElementAt(some_index);
INodeB childNode = parent.nodeB();

Armin

former_member220853
Participant
0 Kudos

Hi All

Thanks for the reply

the cardinality property of my (non-singleton )node is 0..n

wherever in code if I try to get the handle of my non-singleton node

INode nodeB = wdContext.nodeB()

nodeB comes as null

Edited by: Gaurav Singh on Jan 21, 2009 6:50 PM

Former Member
0 Kudos
former_member197348
Active Contributor
0 Kudos

Hi Gaurav,

You have not mentioned nodeA properties.If it's cardinality is 1..x then no need to initialize A otherwise you must initialize A first then initialize nodeB.

Try like this:

//If  cardinality of A is not 1...1
 IPrivateTrstView.IAElement ele = wdContext.createAElement();
//Set if there are any attributes 
 ele.setXXX(); 
 .....
wdContext.nodeA().addElement(ele);

IPrivateTrstView.IBElement ele = wdContext.createBElement();
  ele.setXXX(); 
 .....
wdContext.nodeB().addElement(ele);

The singleton property refers the relationship between the node and its parent but not between the node its child as for as I know.

Regards,

Siva