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

MoveToAttribute() public method

public MoveToAttribute ( string localName, string namespaceURI ) : bool
localName string
namespaceURI string
return bool
        public override bool MoveToAttribute(string localName, string namespaceURI)
        {
            namespaceURI = (namespaceURI == null) ? string.Empty : _nameTable.Get(namespaceURI);
            localName = _nameTable.Get(localName);
            for (int i = _index + 1; i < _index + _attrCount + 1; i++)
            {
                if (Ref.Equal(_nodes[i].localName, localName) &&
                     Ref.Equal(_nodes[i].ns, namespaceURI))
                {
                    _curAttrIndex = i - _index - 1;
                    _curNode = _nodes[i];

                    if (InAttributeValueIterator)
                    {
                        FinishAttributeValueIterator();
                    }
                    return true;
                }
            }
            return false;
        }

Same methods

XmlTextReaderImpl::MoveToAttribute ( string name ) : 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