cancel
Showing results for 
Search instead for 
Did you mean: 

Access a value attribute that has no parent node/element?

Former Member
0 Kudos

Hello everybody,

I wonder whether it is possible to set/get the value of a value attribute direct under the CONTEXT-node?

How can I access by code, e.g. the value attribute is named "value_attribute_without_parent_node"?

Thanks a lot, Mario

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mario,

You can get the value using

wdContext.currentContextElement().get<Attributename>();

i.e

wdContext.currentContextElement().getValue_attribute_without_parent_node();

and set the value using

wdContext.currentContextElement().set<Attributename>(<value>);

i.e

wdContext.currentContextElement().settValue_attribute_without_parent_node(<your value>);

Hope this helps,

Best Regards,

Nibu.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Mario,

If your context attribute is not under any context node then you can write following code for that:

wdcontext.currentContextElement().set<attribute name>(<value>);

wdcontext.currentContextElement().get<attribute name>();

But, if this attribute is under any context node, then first you need to create object for this context node using following code:

ele = wdcontext.create<node name>();

then bind this element to the node.

wdcontext.node<node name>().addelement(ele);

Then, assign value to the value attribute as:

wdcontext.current<node name>Element().set<attribute name>(<value>);

and get same value using:

wdcontext.current<node name>Element().get<attribute name>();

Regards,

Bhavik

Former Member
0 Kudos

Hi,

"Context" is the rootnode . If you create simple value attributes then rootnode is the parent for that and you can access through currentContextElement() .

Regards, Anilkumar