XmlTextReader.MoveToNextAttribute Método

Definición

Se mueve al atributo siguiente.

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

Devoluciones

true si hay un atributo siguiente; false si no hay más atributos.

Ejemplos

En el ejemplo siguiente se muestran todos los atributos del nodo actual.

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

Comentarios

Note

Se recomienda crear XmlReader instancias mediante el XmlReader.Create método para aprovechar las nuevas funcionalidades.

Si el nodo actual es un nodo de elemento, este método es equivalente a MoveToFirstAttribute. Si MoveToNextAttribute devuelve true, el lector se mueve al atributo siguiente; de lo contrario, la posición del lector no cambia.

Se aplica a

Consulte también