Showing results for 
Search instead for 
Did you mean: 

Accessing node elements at runtime

Former Member
0 Kudos

At design time I create parent node FieldDescriptors (Singleton, cardinality - 0:n), and child nodes Test10, Test20. Bothe child nodes are singleton, and cardinality 0:n.

Get nullpointer exception when executing the following code. Please advise what is wrong with the code.

IWDNode node = wdContext.nodeFieldDescriptors().getChildNode("Test10",IWDNode.LEAD_SELECTION);

String test = node.getCurrentElement().getAttributeAsText("element1");

Thanks !

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi srikanth,

I think you have not bound object to the node.

You have to create object of the node and bind this object to hte Node.

And one more question. What excatly you are trying to do with this coding?



Former Member
0 Kudos

IWDNode nodeTest10 = wdContext.nodeFieldDescriptors().getChildNode("Test10",IWDNode.LEAD_SELECTION);

IWDNodeElement nodeElement = nodeTest10.createElement();



String test = nodeTest10.getCurrentElememt().getAttributeAsText("element1");

Hope this helps.

Former Member
0 Kudos

have u created an instance of the node Test10 that u have created?

Former Member
0 Kudos

create an element

iprivate<view>.i<node >element ele=wdcontext.create<nodename >element


You can access the node as follows

IWDNode node=wdContext.node<nodename>();