Opc.Ua.JsonDecoder.ReadXmlElement C# (CSharp) Method

ReadXmlElement() public method

Reads an XmlElement from the stream.
public ReadXmlElement ( string fieldName ) : XmlElement
fieldName string
return System.Xml.XmlElement
        public XmlElement ReadXmlElement(string fieldName)
        {
            object token = null;

            if (!ReadField(fieldName, out token))
            {
                return null;
            }

            var value = token as string;

            if (value == null)
            {
                return null;
            }

            var bytes = Convert.FromBase64String(value);

            if (bytes != null && bytes.Length > 0)
            {
                XmlDocument document = new XmlDocument();
                document.InnerXml = new UTF8Encoding().GetString(bytes);

                return document.DocumentElement;
            }

            return null;
        }