System.Xml.XmlTextReaderImpl.MoveToAttribute C# (CSharp) Method

MoveToAttribute() public method

public MoveToAttribute ( string name ) : bool
name string
return bool
        public override bool MoveToAttribute(string name)
        {
            int i;
            if (name.IndexOf(':') == -1)
            {
                i = GetIndexOfAttributeWithoutPrefix(name);
            }
            else
            {
                i = GetIndexOfAttributeWithPrefix(name);
            }

            if (i >= 0)
            {
                if (InAttributeValueIterator)
                {
                    FinishAttributeValueIterator();
                }
                _curAttrIndex = i - _index - 1;
                _curNode = _nodes[i];
                return true;
            }
            else
            {
                return false;
            }
        }

Same methods

XmlTextReaderImpl::MoveToAttribute ( string localName, string namespaceURI ) : bool
XmlTextReaderImpl::MoveToAttribute ( int i ) : void

Usage Example

示例#1
0
#pragma warning restore 618

        internal static void ParseXmlDeclarationValue(string strValue, out string version, out string encoding, out string standalone)
        {
            version    = null;
            encoding   = null;
            standalone = null;
            XmlTextReaderImpl tempreader = new XmlTextReaderImpl(strValue, (XmlParserContext)null);

            try
            {
                tempreader.Read();
                //get version info.
                if (tempreader.MoveToAttribute(nameof(version)))
                {
                    version = tempreader.Value;
                }
                //get encoding info
                if (tempreader.MoveToAttribute(nameof(encoding)))
                {
                    encoding = tempreader.Value;
                }
                //get standalone info
                if (tempreader.MoveToAttribute(nameof(standalone)))
                {
                    standalone = tempreader.Value;
                }
            }
            finally
            {
                tempreader.Close();
            }
        }
All Usage Examples Of System.Xml.XmlTextReaderImpl::MoveToAttribute
XmlTextReaderImpl