XmlTextReader.MoveToNextAttribute Método

Definição

Move para o próximo atributo.

public:
 override bool MoveToNextAttribute();
public override bool MoveToNextAttribute();
override this.MoveToNextAttribute : unit -> bool
Public Overrides Function MoveToNextAttribute () As Boolean

Retornos

true se houver um próximo atributo; false se não houver mais atributos.

Exemplos

O exemplo a seguir exibe todos os atributos no nó atual.

public void DisplayAttributes(XmlReader reader)
{
    if (reader.HasAttributes)
    {
        Console.WriteLine("Attributes of <" + reader.Name + ">");
        while (reader.MoveToNextAttribute())
        {
            Console.WriteLine(" {0}={1}", reader.Name, reader.Value);
        }
    }
}
Public Sub DisplayAttributes(reader As XmlReader)
    If reader.HasAttributes Then
        Console.WriteLine("Attributes of <" & reader.Name & ">")
        While reader.MoveToNextAttribute()
            Console.WriteLine(" {0}={1}", reader.Name, reader.Value)
        End While
    End If
End Sub

Comentários

Note

Recomendamos que você crie XmlReader instâncias usando o XmlReader.Create método para aproveitar a nova funcionalidade.

Se o nó atual for um nó de elemento, esse método será equivalente a MoveToFirstAttribute. Se MoveToNextAttribute retornar true, o leitor passará para o próximo atributo; caso contrário, a posição do leitor não será alterada.

Aplica-se a

Confira também