Opc.Ua.XmlDecoder.ReadNodeId C# (CSharp) Method

ReadNodeId() public method

Reads an NodeId from the stream.
public ReadNodeId ( string fieldName ) : Opc.Ua.NodeId
fieldName string
return Opc.Ua.NodeId
        public NodeId ReadNodeId(string fieldName)
        {
            NodeId value = new NodeId();

            if (BeginField(fieldName, true))
            {                
                PushNamespace(Namespaces.OpcUaXsd);
                value.IdentifierText = ReadString("Identifier");
                PopNamespace();
                
                EndField(fieldName);
            }

            if (m_namespaceMappings != null && m_namespaceMappings.Length > value.NamespaceIndex)
            {
                value.SetNamespaceIndex(m_namespaceMappings[value.NamespaceIndex]);
            }

            return value;
        }
             

Usage Example

        /// <summary>
        /// Updates the attributes from the stream.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="decoder">The decoder wrapping the stream to read.</param>
        public override void Update(ISystemContext context, XmlDecoder decoder)
        {
            base.Update(context, decoder);

            decoder.PushNamespace(Namespaces.OpcUaXsd);

            if (decoder.Peek("Value"))
            {
                WrappedValue = decoder.ReadVariant("Value");
            }

            if (decoder.Peek("DataType"))
            {
                DataType = decoder.ReadNodeId("DataType");
            }

            if (decoder.Peek("ValueRank"))
            {
                ValueRank = decoder.ReadInt32("ValueRank");
            }

            if (decoder.Peek("ArrayDimensions"))
            {
                ArrayDimensions = BaseVariableState.ArrayDimensionsFromXml(decoder.ReadString("ArrayDimensions"));
            }

            decoder.PopNamespace();
        }
All Usage Examples Of Opc.Ua.XmlDecoder::ReadNodeId