XmlReader.IsStartElement 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 콘텐츠 노드가 시작 태그인지 테스트합니다.
오버로드
| Name | Description |
|---|---|
| IsStartElement(String, String) |
현재 콘텐츠 노드가 시작 태그인지 빈 요소 태그인지, 찾은 요소의 속성이 지정된 문자열과 일치하는지 MoveToContent() 여부를 호출 LocalName 하고 NamespaceURI 테스트합니다. |
| IsStartElement() |
현재 콘텐츠 노드가 시작 태그인지 빈 요소 태그인지를 호출 MoveToContent() 하고 테스트합니다. |
| IsStartElement(String) |
현재 콘텐츠 노드가 시작 태그인지 빈 요소 태그인지, 찾은 요소의 속성이 지정된 인수와 일치하는지 MoveToContent() 여부를 호출 Name 하고 테스트합니다. |
IsStartElement(String, String)
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
현재 콘텐츠 노드가 시작 태그인지 빈 요소 태그인지, 찾은 요소의 속성이 지정된 문자열과 일치하는지 MoveToContent() 여부를 호출 LocalName 하고 NamespaceURI 테스트합니다.
public:
virtual bool IsStartElement(System::String ^ localname, System::String ^ ns);
public virtual bool IsStartElement(string localname, string ns);
abstract member IsStartElement : string * string -> bool
override this.IsStartElement : string * string -> bool
Public Overridable Function IsStartElement (localname As String, ns As String) As Boolean
매개 변수
- localname
- String
찾은 요소의 속성과 LocalName 일치하는 문자열입니다.
- ns
- String
찾은 요소의 속성과 NamespaceURI 일치하는 문자열입니다.
반품
true 결과 노드가 요소이면 입니다.
false 노드 형식을 찾을 XmlNodeType.Element 수 없거나 요소의 LocalName 속성이 지정된 문자열과 NamespaceURI 일치하지 않으면 입니다.
예외
입력 스트림에서 잘못된 XML이 발견되었습니다.
XmlReader 이전 비동기 작업이 완료되기 전에 메서드가 호출되었습니다. 이 경우 InvalidOperationException "비동기 작업이 이미 진행 중입니다."라는 메시지와 함께 throw됩니다.
설명
이 메서드는 판독기를 콘텐츠 노드에 배치할 때까지 공백, 주석 및 처리 지침을 건너뜁니다. 그런 다음 메서드는 현재 노드가 요소인지 테스트합니다.
추가 정보
적용 대상
IsStartElement()
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
현재 콘텐츠 노드가 시작 태그인지 빈 요소 태그인지를 호출 MoveToContent() 하고 테스트합니다.
public:
virtual bool IsStartElement();
public virtual bool IsStartElement();
abstract member IsStartElement : unit -> bool
override this.IsStartElement : unit -> bool
Public Overridable Function IsStartElement () As Boolean
반품
예외
입력 스트림에서 잘못된 XML이 발견되었습니다.
XmlReader 이전 비동기 작업이 완료되기 전에 메서드가 호출되었습니다. 이 경우 InvalidOperationException "비동기 작업이 이미 진행 중입니다."라는 메시지와 함께 throw됩니다.
예제
다음은 각 요소의 텍스트 내용을 표시하는 예제입니다.
while (reader.Read()) {
if (reader.IsStartElement()) {
if (reader.IsEmptyElement)
{
Console.WriteLine("<{0}/>", reader.Name);
}
else {
Console.Write("<{0}> ", reader.Name);
reader.Read(); // Read the start tag.
if (reader.IsStartElement()) // Handle nested elements.
Console.Write("\r\n<{0}>", reader.Name);
Console.WriteLine(reader.ReadString()); //Read the text content of the element.
}
}
}
While reader.Read()
If reader.IsStartElement() Then
If reader.IsEmptyElement Then
Console.WriteLine("<{0}/>", reader.Name)
Else
Console.Write("<{0}> ", reader.Name)
reader.Read() ' Read the start tag.
If reader.IsStartElement() Then ' Handle nested elements.
Console.Write(vbCr + vbLf + "<{0}>", reader.Name)
End If
Console.WriteLine(reader.ReadString()) 'Read the text content of the element.
End If
End If
End While
이 예제에서는 파일을 elems.xml입력으로 사용합니다.
<book>
<title>Pride And Prejudice</title>
<price>19.95</price>
<misc/>
</book>
설명
이 메서드는 판독기를 콘텐츠 노드에 배치할 때까지 공백, 주석 및 처리 지침을 건너뜁니다. 그런 다음 메서드는 현재 노드가 요소인지 테스트합니다.
추가 정보
적용 대상
IsStartElement(String)
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
현재 콘텐츠 노드가 시작 태그인지 빈 요소 태그인지, 찾은 요소의 속성이 지정된 인수와 일치하는지 MoveToContent() 여부를 호출 Name 하고 테스트합니다.
public:
virtual bool IsStartElement(System::String ^ name);
public virtual bool IsStartElement(string name);
abstract member IsStartElement : string -> bool
override this.IsStartElement : string -> bool
Public Overridable Function IsStartElement (name As String) As Boolean
매개 변수
- name
- String
찾은 요소의 속성과 Name 일치하는 문자열입니다.
반품
true 결과 노드가 요소이고 속성이 Name 지정된 문자열과 일치하면 입니다.
false 노드 형식을 찾을 XmlNodeType.Element 수 없거나 요소 Name 속성이 지정된 문자열과 일치하지 않는 경우
예외
입력 스트림에서 잘못된 XML이 발견되었습니다.
XmlReader 이전 비동기 작업이 완료되기 전에 메서드가 호출되었습니다. 이 경우 InvalidOperationException "비동기 작업이 이미 진행 중입니다."라는 메시지와 함께 throw됩니다.
예제
다음 예제에서는 각 가격 요소를 표시합니다.
// Parse the file and display each price node.
while (reader.Read()) {
if (reader.IsStartElement("price")) {
Console.WriteLine(reader.ReadInnerXml());
}
}
' Parse the file and display each price node.
While reader.Read()
If reader.IsStartElement("price") Then
Console.WriteLine(reader.ReadInnerXml())
End If
End While
설명
이 메서드는 판독기를 콘텐츠 노드에 배치할 때까지 공백, 주석 및 처리 지침을 건너뜁니다. 그런 다음 메서드는 현재 노드가 요소인지 테스트합니다.