次の方法で共有


XmlTextReader.MoveToNextAttribute メソッド

次の属性に移動します。

Overrides Public Function MoveToNextAttribute() As Boolean
[C#]
public override bool MoveToNextAttribute();
[C++]
public: bool MoveToNextAttribute();
[JScript]
public override function MoveToNextAttribute() : Boolean;

戻り値

次の属性が存在する場合は true 。それ以上、属性が存在しない場合は false

解説

現在のノードが要素ノードである場合、このメソッドは MoveToFirstAttribute と等価になります。 MoveToNextAttributetrue を返す場合は、リーダーが次の属性に移動します。それ以外の場合、リーダーの位置は変更されません。

使用例

[Visual Basic, C#, C++] 現在のノードのすべての属性を表示する例を次に示します。

 
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 'DisplayAttributes

[C#] 
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);
        }
    }
}

[C++] 
public:
    void DisplayAttributes(XmlReader* reader)
    {
        if (reader->HasAttributes)
        {
            Console::WriteLine(S"Attributes of <{0}>", reader->Name);
            while (reader->MoveToNextAttribute())
            {
                Console::WriteLine(S" {0}={1}", reader->Name, reader->Value);
            }
        }
    }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

XmlTextReader クラス | XmlTextReader メンバ | System.Xml 名前空間