Skip to Content
author's profile photo Former Member
Former Member

Accessing node elements at runtime

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 !

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2005 at 04:42 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      create an element

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

      wdcontext.node<nodename>.bind(ele);

      You can access the node as follows

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

      node.current<nodename>element.get<attribute>();

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2005 at 04:52 AM

    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?

    Regards,

    Bhavik

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

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

      IWDNodeElement nodeElement = nodeTest10.createElement();

      node.addElement(nodeElement);

      nodeElement.setAttributeValue("element1","value");

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

      Hope this helps.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.