1

Here my code is for iterating the nodes, but its also iterating for the leaf node and checking for its child(which is the tag node), how can I directly know if the current node is tag node or not, without seeing for its child. below is my java code: '''

private void browseNode(String pName, OpcUaClient client, NodeId browseRoot)

'''

khÜs h
  • 51
  • 6

1 Answers1

1

Nodes that are NodeClass.Variable have a Value attribute, which is probably what you would consider a "tag" Node.

OPC UA allows Variable Nodes to have child Variable Nodes as well, though, so you can't necessarily stop browsing just because you hit a Variable Node.

Kevin Herron
  • 6,500
  • 3
  • 26
  • 35
  • Thanks for your answer Kevin, so suppose the node we are currently standing on is a variable node.If that node has a value attribute than we will declare it as tag if not we will go for its child. Doesn't this method help to save that extra iteration. – khÜs h Jul 16 '22 at 07:26
  • 1
    No, you still need to browse, because like I said, Variable Nodes can have child Variable Nodes as well. One common example would be the Variable Node for an array value having additional Variable Node children for each of its elements values. – Kevin Herron Jul 16 '22 at 12:25
  • Can you please tell me how can I fetch that value attribute of variable node? – khÜs h Sep 21 '22 at 11:57
  • 1
    @khÜsh use the Read service to read the Value attribute. Or depending on the SDK/API you are using it may be possible to have that done for you. – Kevin Herron Sep 21 '22 at 13:53