XmlReader.MoveToAttribute 메서드

정의

파생 클래스에서 재정의되면 지정된 특성으로 이동합니다.

오버로드

MoveToAttribute(Int32)

파생 클래스에서 재정의되면 지정된 인덱스가 있는 특성으로 이동합니다.

MoveToAttribute(String)

파생 클래스에서 재정의되면 지정된 Name이 있는 특성으로 이동합니다.

MoveToAttribute(String, String)

파생 클래스에서 재정의되면 지정된 LocalNameNamespaceURI가 있는 특성으로 이동합니다.

MoveToAttribute(Int32)

파생 클래스에서 재정의되면 지정된 인덱스가 있는 특성으로 이동합니다.

public:
 virtual void MoveToAttribute(int i);
public:
 abstract void MoveToAttribute(int i);
public virtual void MoveToAttribute (int i);
public abstract void MoveToAttribute (int i);
abstract member MoveToAttribute : int -> unit
override this.MoveToAttribute : int -> unit
abstract member MoveToAttribute : int -> unit
Public Overridable Sub MoveToAttribute (i As Integer)
Public MustOverride Sub MoveToAttribute (i As Integer)

매개 변수

i
Int32

특성의 인덱스입니다.

예외

이전 비동기 작업이 완료되기 전에 XmlReader 메서드가 호출되었습니다. 이 경우 “비동기 작업이 이미 진행 중입니다.” 메시지를 나타내며 InvalidOperationException이 throw됩니다.

매개 변수에 음수 값이 있습니다.

예제

다음 예제에서는 현재 노드의 모든 특성을 표시합니다.

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.
}
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

적용 대상

MoveToAttribute(String)

파생 클래스에서 재정의되면 지정된 Name이 있는 특성으로 이동합니다.

public:
 abstract bool MoveToAttribute(System::String ^ name);
public abstract bool MoveToAttribute (string name);
abstract member MoveToAttribute : string -> bool
Public MustOverride Function MoveToAttribute (name As String) As Boolean

매개 변수

name
String

특성의 정규화된 이름입니다.

반환

Boolean

특성이 있으면 true이고, 그렇지 않으면 false입니다. false이면, 판독기의 위치는 변경되지 않습니다.

예외

이전 비동기 작업이 완료되기 전에 XmlReader 메서드가 호출되었습니다. 이 경우 “비동기 작업이 이미 진행 중입니다.” 메시지를 나타내며 InvalidOperationException이 throw됩니다.

매개 변수가 빈 문자열인 경우

설명

호출 MoveToAttributeName후 , NamespaceURIPrefix 속성은 해당 특성의 속성을 반영합니다.

적용 대상

MoveToAttribute(String, String)

파생 클래스에서 재정의되면 지정된 LocalNameNamespaceURI가 있는 특성으로 이동합니다.

public:
 abstract bool MoveToAttribute(System::String ^ name, System::String ^ ns);
public abstract bool MoveToAttribute (string name, string ns);
public abstract bool MoveToAttribute (string name, string? ns);
abstract member MoveToAttribute : string * string -> bool
Public MustOverride Function MoveToAttribute (name As String, ns As String) As Boolean

매개 변수

name
String

특성의 로컬 이름입니다.

ns
String

특성의 네임스페이스 URI입니다.

반환

Boolean

특성이 있으면 true이고, 그렇지 않으면 false입니다. false이면, 판독기의 위치는 변경되지 않습니다.

예외

이전 비동기 작업이 완료되기 전에 XmlReader 메서드가 호출되었습니다. 이 경우 “비동기 작업이 이미 진행 중입니다.” 메시지를 나타내며 InvalidOperationException이 throw됩니다.

두 매개 변수 값이 모두 null인 경우

설명

호출 MoveToAttributeName후 , NamespaceURIPrefix 속성은 해당 특성의 속성을 반영합니다.

적용 대상