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

Skip() public method

Skips to the end of the specified element.
public Skip ( XmlQualifiedName qname ) : void
qname System.Xml.XmlQualifiedName The qualified name of the element to skip.
return void
        public void Skip(XmlQualifiedName qname)
        {
            m_reader.MoveToContent();

            int depth = 1;

            while (depth > 0)
            {
                if (m_reader.NodeType == XmlNodeType.EndElement)
                {
                    if (m_reader.LocalName == qname.Name && m_reader.NamespaceURI == qname.Namespace)
                    {
                        depth--;
                    }
                }

                else if (m_reader.NodeType == XmlNodeType.Element)
                {
                    if (m_reader.LocalName == qname.Name && m_reader.NamespaceURI == qname.Namespace)
                    {
                        depth++;
                    }
                }

                m_reader.Skip();
                m_reader.MoveToContent();
            }      
        }