XmlTextReader.MoveToNextAttribute Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Passe à l’attribut suivant.
public:
override bool MoveToNextAttribute();
public override bool MoveToNextAttribute();
override this.MoveToNextAttribute : unit -> bool
Public Overrides Function MoveToNextAttribute () As Boolean
Retours
true s’il existe un attribut suivant ; false s’il n’y a plus d’attributs.
Exemples
L’exemple suivant affiche tous les attributs sur le nœud actuel.
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
Remarques
Note
Nous vous recommandons de créer des instances XmlReader à l’aide de la méthode XmlReader.Create pour tirer parti de nouvelles fonctionnalités.
Si le nœud actuel est un nœud d’élément, cette méthode équivaut à MoveToFirstAttribute. Si MoveToNextAttribute cette propriété est retournée true, le lecteur passe à l’attribut suivant ; sinon, la position du lecteur ne change pas.