Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 20, 2005 at 08:36 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2005 at 08:39 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2005 at 08:45 AM

    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

    Add comment
    10|10000 characters needed characters exceeded