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

MoveToAttribute() public method

public MoveToAttribute ( int i ) : void
i int
return void
        public virtual void MoveToAttribute(int i)
        {
            if (i < 0 || i >= AttributeCount)
            {
                throw new ArgumentOutOfRangeException(nameof(i));
            }
            MoveToElement();
            MoveToFirstAttribute();
            int j = 0;
            while (j < i)
            {
                MoveToNextAttribute();
                j++;
            }
        }

Same methods

XmlReader::MoveToAttribute ( string name ) : bool
XmlReader::MoveToAttribute ( string name, string ns ) : bool

Usage Example

Esempio n. 1
0
 public void ReadLog(XmlReader reader)
 {
     while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
     {
         Dictionary<string, string> attributes = new Dictionary<string, string>();
         if (reader.Name == "ME")
         {
             if (reader.HasAttributes)
             {
                 for (int i = 0; i < reader.AttributeCount; i++)
                 {
                     reader.MoveToAttribute(i);
                     attributes.Add(reader.Name, reader.Value);
                 }
             }
             MouseEvent e = new MouseEvent(attributes);
             Evnts.AddLast(e);
             //do shit here
         }
         else if (reader.Name == "Clickthrough")
         {
                 if (reader.HasAttributes)
                 {
                     for (int i = 0; i < reader.AttributeCount; i++)
                     {
                         reader.MoveToAttribute(i);
                         attributes.Add(reader.Name, reader.Value);
                     }
                 }
             Clickthrough c = new Clickthrough(attributes);
             c.ReadLog(reader);
             Evnts.AddLast(c);
         }
     }
 }
All Usage Examples Of System.Xml.XmlReader::MoveToAttribute