OPC Studio User's Guide and Reference
Parse Method (UABrowsePathParser)
Example 



View with Navigation Tools
OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Navigation.Parsing Namespace > UABrowsePathParser Class : Parse Method
The string containing the absolute browse path to be parsed.

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

Parses a string containing an absolute browse path, and returns a corresponding browse path object.
Syntax
'Declaration
 
<JetBrains.Annotations.MustUseReturnValueAttribute()>
<JetBrains.Annotations.NotNullAttribute()>
<JetBrains.Annotations.PureAttribute()>
Public Function Parse( _
   ByVal value As String _
) As UABrowsePath
 
'Usage
 
Dim instance As UABrowsePathParser
Dim value As String
Dim value As UABrowsePath
 
value = instance.Parse(value)

Parameters

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

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

Return Value

Returns the browse path object parsed from the input value.

Because there is an implicit conversion from OpcLabs.EasyOpc.UA.Navigation.UABrowsePath to OpcLabs.EasyOpc.UA.UANodeDescriptor, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use the returned OpcLabs.EasyOpc.UA.Navigation.UABrowsePath in any place where the OpcLabs.EasyOpc.UA.UANodeDescriptor is expected as input, and the corresponding node descriptor will be constructed automatically.

This method never returns null (Nothing in Visual Basic).

This return value of this method should not be ignored.

Exceptions
ExceptionDescription
Thrown when the OPC UA browse path cannot be parsed.
Remarks
The input browse path must be absolute.

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

Example
// Parses an absolute OPC-UA browse path and displays its starting node and elements.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// 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.

using System;
using OpcLabs.EasyOpc.UA.Navigation;
using OpcLabs.EasyOpc.UA.Navigation.Parsing;

namespace UACommonDocExamples._UABrowsePathParser
{
    class Parse
    {
        public static void Main1()
        {
            var browsePathParser = new UABrowsePathParser();
            UABrowsePath browsePath;
            try
            {
                browsePath = browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar");
            }
            catch (UABrowsePathFormatException browsePathFormatException)
            {
                Console.WriteLine("*** Failure: {0}", browsePathFormatException.GetBaseException().Message);
                return;
            }

            // Display results
            Console.WriteLine("StartingNodeId: {0}", browsePath.StartingNodeId);

            foreach (UABrowsePathElement browsePathElement in browsePath.Elements)
                Console.WriteLine(browsePathElement);

            // Example output:
            // StartingNodeId: ObjectsFolder
            // /Data
            // /Static
            // /UserScalar
        }
    }
}
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