cancel
Showing results for 
Search instead for 
Did you mean: 

Creating value node

Former Member
0 Kudos

Hello All,

I have a context node:

Context

|__MyValueNode (0..N, singleton = true)

....|__MyChildValueNode (0..N, singleton = true)

....|__MyValueAttribute

(The .... is just to position things properly).

I was wondering how to take a newly created MyChildValueNode and add it to MyValueNode.

Thanks for your help.

Mike

Edited by: Mike Yang on May 6, 2008 5:58 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mike,

As per your inputs, there is one parent node named MyValueNode and child node named MyChildValueNode.To create a new child node,follow the steps mentioned below:

Step 1: First create the element of parent node as

IMyValueNodeElement objMyValueNode=wdContext.nodeMyValueNode().createMyValuNodeElement();

Step 2. Bind this element to node as

wdContext.nodeMyValueNode().add(objMyValueNode);

Step 3 .Now create elemet of child node as

IMyChildValueNodeElement objMyChildValueNode=wdContext.nodeMyChildValueNode().createMyChildValueNodeElement();

Step 4. Bind this element to node as

wdContext.nodeMyChildValueNode().add(objMyChildValueNode);

regards,

amit bagati

Answers (3)

Answers (3)

Former Member
0 Kudos
nikhil_bose
Active Contributor
0 Kudos

Context

|__MyValueNode (0..N, singleton = true)

....|__MyChildValueNode (0..N, singleton = true)

....|__MyValueAttribute

When creating element, we gives the exact node element. In fact, this is Context at design time and at runtime its behavior is deferent.

e.g:


IPrivate<Comp_Name>.IMyChildValueNodeElement element;

will create type of MyChildValueNode


element = wdContext.createMyChildValueNodeElement();

And you can add this one to MyChildValueNode only


wdContext.nodeMyChildValueNode().addElement( element);

You can access the attributes using the nodeElement references


element.getMyChildValueAttribute();
wdContext.currentMyChildValueNode().getMyChildValueAttribute();

if you want parent attribute


wdContext.currentMyValueNode().getMyValueAttribute();

nikhiL

Former Member
0 Kudos

Hi,

IPublic<component name>.IMyValueNode element = wdContext.nodeMyValueNode().createMyValueNodeElement();

IPublic<component name>.IMyChildValueNode child = wdContext.nodeMyChildValueNode().createMyChildValueNodeElement();

element.nodeMyChildValueNode().add(child);

wdContext.nodeMyValueNode().add(element);

Regards,

Murtuza