指定した属性に移動します。
オーバーロードの一覧
指定したインデックスを持つ属性に移動します。
.NET Compact Framework でもサポート。
[Visual Basic] Overloads Overrides Public Sub MoveToAttribute(Integer)
指定した名前を持つ属性へ移動します。
.NET Compact Framework でもサポート。
[Visual Basic] Overloads Overrides Public Function MoveToAttribute(String) As Boolean
[JScript] public override function MoveToAttribute(String) : Boolean;
指定したローカル名および名前空間 URI の属性に移動します。
.NET Compact Framework でもサポート。
[Visual Basic] Overloads Overrides Public Function MoveToAttribute(String, String) As Boolean
[JScript] public override function MoveToAttribute(String, String) : Boolean;
使用例
[Visual Basic, C#, C++] 現在のノードのすべての属性を表示する例を次に示します。
[Visual Basic, C#, C++] メモ ここでは、MoveToAttribute のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
Public Sub DisplayAttributes(reader As XmlReader)
If reader.HasAttributes Then
Console.WriteLine("Attributes of <" & reader.Name & ">")
Dim i As Integer
For i = 0 To reader.AttributeCount - 1
reader.MoveToAttribute(i)
Console.Write(" {0}={1}", reader.Name, reader.Value)
Next i
reader.MoveToElement() 'Moves the reader back to the element node.
End If
End Sub 'DisplayAttributes
[C#]
public void DisplayAttributes(XmlReader reader)
{
if (reader.HasAttributes)
{
Console.WriteLine("Attributes of <" + reader.Name + ">");
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
Console.Write(" {0}={1}", reader.Name, reader.Value);
}
reader.MoveToElement(); //Moves the reader back to the element node.
}
}
[C++]
public:
void DisplayAttributes(XmlReader* reader)
{
if (reader->HasAttributes)
{
Console::WriteLine(S"Attributes of <{0}>", reader->Name);
for (int i = 0; i < reader->AttributeCount; i++)
{
reader->MoveToAttribute(i);
Console::Write(S" {0}={1}", reader->Name, reader->Value);
}
reader->MoveToElement(); //Moves the reader back to the element node.
}
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。