// Parses a relative OPC-UA browse path and displays its elements.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in Object Pascal (Delphi) on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-OP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.
class procedure ParseRelative.Main;
var
BrowsePathElement: _UABrowsePathElement;
BrowsePathElements: _UABrowsePathElementCollection;
BrowsePathParser: OpcLabs_EasyOpcUA_TLB._UABrowsePathParser;
Count: Cardinal;
Element: OleVariant;
ElementEnumerator: IEnumVariant;
begin
BrowsePathParser := CoUABrowsePathParser.Create;
try
BrowsePathElements := BrowsePathParser.ParseRelative('/Data.Dynamic.Scalar.CycleComplete');
except
on E: EOleException do
begin
WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
Exit;
end;
end;
// Display results
ElementEnumerator := BrowsePathElements.GetEnumerator;
while (ElementEnumerator.Next(1, Element, Count) = S_OK) do
begin
BrowsePathElement := IUnknown(Element) as _UABrowsePathElement;
WriteLn(BrowsePathElement.ToString);
end;
// Example output:
// /Data
// .Dynamic
// .Scalar
// .CycleComplete
end;
// Parses a relative OPC-UA browse path and displays its elements.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in PHP on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PHP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.
$BrowsePathParser = new COM("OpcLabs.EasyOpc.UA.Navigation.Parsing.UABrowsePathParser");
try
{
$BrowsePathElements = $BrowsePathParser->ParseRelative("/Data.Dynamic.Scalar.CycleComplete");
}
catch (com_exception $e)
{
printf("*** Failure: %s\n", $e->getMessage());
exit();
}
// Display results
for ($i = 0; $i < $BrowsePathElements->Count; $i++)
{
printf("%s\n", $BrowsePathElements[$i]);
}
// Example output:
// /Data
// .Dynamic
// .Scalar
// .CycleComplete
REM Parses a relative OPC-UA browse path and displays its elements.
REM
REM Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
REM OPC client and subscriber examples in Visual Basic on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VB .
REM Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
REM a commercial license in order to use Online Forums, and we reply to every post.
Private Sub ParseRelative_Main_Command_Click()
OutputText = ""
Dim BrowsePathParser As New UABrowsePathParser
On Error Resume Next
Dim BrowsePathElements As UABrowsePathElementCollection
Set BrowsePathElements = BrowsePathParser.ParseRelative("/Data.Dynamic.Scalar.CycleComplete")
If Err.Number <> 0 Then
OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
Exit Sub
End If
On Error GoTo 0
' Display results
Dim BrowsePathElement: For Each BrowsePathElement In BrowsePathElements
OutputText = OutputText & BrowsePathElement & vbCrLf
Next
' Example output:
'/Data
'.Dynamic
'.Scalar
'.CycleComplete
End Sub
Rem Parses a relative OPC-UA browse path and displays its elements.
Rem
Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript .
Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
Rem a commercial license in order to use Online Forums, and we reply to every post.
Option Explicit
Dim BrowsePathParser: Set BrowsePathParser = CreateObject("OpcLabs.EasyOpc.UA.Navigation.Parsing.UABrowsePathParser")
On Error Resume Next
Dim BrowsePathElements: Set BrowsePathElements = BrowsePathParser.ParseRelative("/Data.Dynamic.Scalar.CycleComplete")
If Err.Number <> 0 Then
WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
WScript.Quit
End If
On Error Goto 0
' Display results
Dim BrowsePathElement: For Each BrowsePathElement In BrowsePathElements
WScript.Echo BrowsePathElement
Next