// This example shows how to obtain all branches at the root of the address space. For each branch, it displays whether
// it may have child nodes.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;
namespace DocExamples.DataAccess.Xml
{
class BrowseBranches
{
public static void Main1Xml()
{
// Instantiate the client object.
var client = new EasyDAClient();
DANodeElementCollection branchElements;
try
{
branchElements = client.BrowseBranches("http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx");
}
catch (OpcException opcException)
{
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
return;
}
foreach (DANodeElement branchElement in branchElements)
Console.WriteLine($"BranchElements(\"{branchElement.Name}\").HasChildren: {branchElement.HasChildren}");
}
// Example output:
//
//BranchElements("Static").HasChildren: True
//BranchElements("Dynamic").HasChildren: True
}
}
# This example shows how to obtain all branches at the root of the address space. For each branch, it displays whether
# it may have child nodes.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
# Import .NET namespaces.
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.DataAccess.AddressSpace import *
from OpcLabs.EasyOpc.OperationModel import *
# Instantiate the client object.
client = EasyDAClient()
try:
branchElements = IEasyDAClientExtension.BrowseBranches(client, ServerDescriptor('http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx'))
except OpcException as opcException:
print('*** Failure: ' + opcException.GetBaseException().Message, sep='')
exit()
for branchElement in branchElements:
print('BranchElements("', branchElement.Name, '").HasChildren: ', branchElement.HasChildren, sep='')
# Example output:
#
#BranchElements("Static").HasChildren: True
#BranchElements("Dynamic").HasChildren: True
' This example shows how to obtain all branches at the root of the address space. For each branch, it displays whether
' it may have child nodes.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel
Namespace DataAccess.Xml
Partial Friend Class BrowseBranches
Shared Sub Main1Xml()
Dim client = New EasyDAClient()
Dim branchElements As DANodeElementCollection
Try
branchElements = client.BrowseBranches("http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx")
Catch opcException As OpcException
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
Exit Sub
End Try
For Each branchElement In branchElements
Console.WriteLine($"BranchElements(""{branchElement.Name}"").HasChildren: {branchElement.HasChildren}")
Next branchElement
End Sub
' Example output
'
'BranchElements("Static").HasChildren: True
'BranchElements("Dynamic").HasChildren: True
End Class
End Namespace