OPC Studio User's Guide and Reference
TryParseRelative Method (_UABrowsePathParser)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Navigation.Parsing.ComTypes Namespace > _UABrowsePathParser Interface : TryParseRelative Method
The string containing the relative browse path to be parsed.

The value of this parameter can be null (Nothing in Visual Basic).

OpcLabs.EasyOpc.UA.Navigation.UABrowsePathElementCollection. If successful, an original collection of browse path elements, expanded by elements corresponding to the input string.

Because the OpcLabs.EasyOpc.UA.Navigation.UABrowsePathElementCollection has an implicit conversion from OpcLabs.EasyOpc.UA.AddressSpace.UAQualifiedNameCollection, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.AddressSpace.UAQualifiedNameCollection (containing a sequence of qualified names, assumed to form a relative browse path using "any hierarchical" forward references) in place of this parameter, and the corresponding OPC UA browse path element collection will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the FromUAQualifiedNameCollection static method instead.

The value of this parameter cannot be null (Nothing in Visual Basic).

The individual elements of the parameter value cannot be null (Nothing in Visual Basic).

Attempts to parse a string containing a relative browse path.
Syntax
'Declaration
 
<CanBeNullAttribute()>
Function TryParseRelative( _
   ByVal value As String, _
   ByVal browsePathElementCollection As Object _
) As StringParsingError
'Usage
 
Dim instance As _UABrowsePathParser
Dim value As String
Dim browsePathElementCollection As Object
Dim value As StringParsingError
 
value = instance.TryParseRelative(value, browsePathElementCollection)

Parameters

value
The string containing the relative browse path to be parsed.

The value of this parameter can be null (Nothing in Visual Basic).

browsePathElementCollection
OpcLabs.EasyOpc.UA.Navigation.UABrowsePathElementCollection. If successful, an original collection of browse path elements, expanded by elements corresponding to the input string.

Because the OpcLabs.EasyOpc.UA.Navigation.UABrowsePathElementCollection has an implicit conversion from OpcLabs.EasyOpc.UA.AddressSpace.UAQualifiedNameCollection, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.AddressSpace.UAQualifiedNameCollection (containing a sequence of qualified names, assumed to form a relative browse path using "any hierarchical" forward references) in place of this parameter, and the corresponding OPC UA browse path element collection will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the FromUAQualifiedNameCollection static method instead.

The value of this parameter cannot be null (Nothing in Visual Basic).

The individual elements of the parameter value cannot be null (Nothing in Visual Basic).

Return Value

Returns null if successful; otherwise, some OpcLabs.BaseLib.IStringParsingError indicating the reason of the failure.

This method can return null (Nothing in Visual Basic).

Remarks

This method is pure, i.e. it does not have observable side effects.

This member or type is for use from COM. It is not meant to be used from .NET or Python. Refer to the corresponding .NET member or type instead, if you are developing in .NET or Python.

Example

COM

REM Attempts to parse 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 TryParseRelative_Main_Command_Click()
    OutputText = ""
    
    Dim BrowsePathElements As New UABrowsePathElementCollection
    
    Dim BrowsePathParser As New UABrowsePathParser

    Dim stringParsingError As stringParsingError
    Set stringParsingError = BrowsePathParser.TryParseRelative("/Data.Dynamic.Scalar.CycleComplete", BrowsePathElements)
    
    ' Display results
    If Not stringParsingError Is Nothing Then
        OutputText = OutputText & "*** Error: " & stringParsingError & vbCrLf
        Exit Sub
    End If
    
    Dim BrowsePathElement: For Each BrowsePathElement In BrowsePathElements
        OutputText = OutputText & BrowsePathElement & vbCrLf
    Next

    ' Example output:
    '/Data
    '.Dynamic
    '.Scalar
    '.CycleComplete
End Sub
Rem Attempts to parse 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 BrowsePathElements: Set BrowsePathElements = CreateObject("OpcLabs.EasyOpc.UA.Navigation.UABrowsePathElementCollection")

Dim BrowsePathParser: Set BrowsePathParser = CreateObject("OpcLabs.EasyOpc.UA.Navigation.Parsing.UABrowsePathParser")
Dim StringParsingError: Set StringParsingError = BrowsePathParser.TryParseRelative("/Data.Dynamic.Scalar.CycleComplete", BrowsePathElements)

' Display results
If Not (StringParsingError Is Nothing) Then
    WScript.Echo "*** Error: " & StringParsingError
    WScript.Quit
End If

Dim BrowsePathElement: For Each BrowsePathElement In BrowsePathElements
    WScript.Echo BrowsePathElement
Next
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also