ReadVariantContents() private method

private ReadVariantContents ( TypeInfo &typeInfo ) : object
typeInfo TypeInfo
return object
Exemplo n.º 1
0
        /// <summary>
        /// Converts the XML back to a value.
        /// </summary>
        private Variant GetValue()
        {
            if (!m_textChanged)
            {
                return m_value;
            }

            XmlDocument document = new XmlDocument();
            document.InnerXml = ValueTB.Text;
            
            // find the first element.
            XmlElement element = null;
            
            for (XmlNode node = document.DocumentElement.FirstChild; node != null; node = node.NextSibling)
            {
                element = node as XmlElement;

                if (element != null)
                {
                    break;
                }
            }

            XmlDecoder decoder = new XmlDecoder(element, m_session.MessageContext);

            decoder.PushNamespace(Namespaces.OpcUaXsd);
            TypeInfo typeInfo = null;
            object value = decoder.ReadVariantContents(out typeInfo);

            return new Variant(value, typeInfo);
        }