This documentation is archived and is not being maintained.

XmlValidatingReader.MoveToNextAttribute Method

Moves to the next attribute.

[Visual Basic]
Overrides Public Function MoveToNextAttribute() As Boolean
public override bool MoveToNextAttribute();
public: bool MoveToNextAttribute();
public override function MoveToNextAttribute() : Boolean;

Return Value

true if there is a next attribute; false if there are no more attributes.


If the current node is an element node, this method is equivalent to MoveToFirstAttribute. If MoveToNextAttribute returns true, the reader moves to the next attribute; otherwise, the position of the reader does not change.


[Visual Basic, C#, C++] The following example reads an XML fragment.

[Visual Basic] 
Imports System
Imports System.IO
Imports System.Xml

public class Sample 

  public shared sub Main()

    'Create the validating reader.
    Dim txtreader as XmlTextReader = new XmlTextReader("attrs.xml")
    Dim reader as XmlValidatingReader = new XmlValidatingReader(txtreader)

    'Read the genre attribute.
    Dim genre As String = reader.Value
    Console.WriteLine("The genre value: " & genre)

    'Close the reader.

  End sub
End class 

using System;
using System.IO;
using System.Xml;

public class Sample 
  public static void Main()

    //Create the validating reader.
    XmlTextReader txtreader = new XmlTextReader("attrs.xml");
    XmlValidatingReader reader = new XmlValidatingReader(txtreader);

    //Read the genre attribute.
    string genre=reader.Value;
    Console.WriteLine("The genre value: " + genre);

    //Close the reader.

} // End class

#using <mscorlib.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;

int main()

    //Create the validating reader.
    XmlTextReader* txtreader = new XmlTextReader(S"attrs.xml");
    XmlValidatingReader* reader = new XmlValidatingReader(txtreader);

    //Read the genre attribute.
    String* genre=reader->Value;
    Console::WriteLine(S"The genre value: {0}", genre);

    //Close the reader.


[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

XmlValidatingReader Class | XmlValidatingReader Members | System.Xml Namespace