XmlNode.Item[] 속성

정의

지정된 자식 요소를 가져옵니다.

오버로드

Item[String]

지정된 Name을 가진 첫 번째 자식 요소를 가져옵니다.

Item[String, String]

지정된 LocalNameNamespaceURI를 갖고 있는 첫 번째 자식 요소를 가져옵니다.

Item[String]

지정된 Name을 가진 첫 번째 자식 요소를 가져옵니다.

public:
 virtual property System::Xml::XmlElement ^ default[System::String ^] { System::Xml::XmlElement ^ get(System::String ^ name); };
public virtual System.Xml.XmlElement this[string name] { get; }
public virtual System.Xml.XmlElement? this[string name] { get; }
member this.Item(string) : System.Xml.XmlElement
Default Public Overridable ReadOnly Property Item(name As String) As XmlElement

매개 변수

name
String

검색할 요소의 정규화된 이름입니다.

속성 값

XmlElement

지정된 이름과 일치하는 첫 번째 XmlElement입니다. 일치되는 항목이 없으면 null 참조(Visual Basic의 경우 Nothing)를 반환합니다.

예제

다음 예제에서는 제목 요소를 표시합니다.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;

int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->LoadXml( "<book ISBN='1-861001-57-5'>"
   "<title>Pride And Prejudice</title>"
   "<price>19.95</price>"
   "</book>" );
   XmlNode^ root = doc->FirstChild;
   Console::WriteLine( "Display the title element..." );
   Console::WriteLine( root[ "title" ]->OuterXml );
}
using System;
using System.IO;
using System.Xml;

public class Sample {

  public static void Main() {

    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book ISBN='1-861001-57-5'>" +
                "<title>Pride And Prejudice</title>" +
                "<price>19.95</price>" +
                "</book>");

    XmlNode root = doc.FirstChild;

    Console.WriteLine("Display the title element...");
    Console.WriteLine(root["title"].OuterXml);
  }
}
Option Explicit
Option Strict

Imports System.IO
Imports System.Xml

Public Class Sample
    Public Shared Sub Main()
        
        Dim doc As New XmlDocument()
        doc.LoadXml("<book ISBN='1-861001-57-5'>" & _
                    "<title>Pride And Prejudice</title>" & _ 
                    "<price>19.95</price>" & _ 
                    "</book>")

        Dim root As XmlNode = doc.FirstChild
        Console.WriteLine("Display the title element...")
        Console.WriteLine(root("title").OuterXml)
    End Sub
End Class

설명

이 속성은 DOM(문서 개체 모델)에 대한 Microsoft 확장입니다.

적용 대상

Item[String, String]

지정된 LocalNameNamespaceURI를 갖고 있는 첫 번째 자식 요소를 가져옵니다.

public:
 virtual property System::Xml::XmlElement ^ default[System::String ^, System::String ^] { System::Xml::XmlElement ^ get(System::String ^ localname, System::String ^ ns); };
public virtual System.Xml.XmlElement this[string localname, string ns] { get; }
public virtual System.Xml.XmlElement? this[string localname, string ns] { get; }
member this.Item(string * string) : System.Xml.XmlElement
Default Public Overridable ReadOnly Property Item(localname As String, ns As String) As XmlElement

매개 변수

localname
String

요소의 로컬 이름입니다.

ns
String

요소의 네임스페이스 URI입니다.

속성 값

XmlElement

일치하는 localnamens를 갖고 있는 첫 번째 XmlElement입니다. 일치되는 항목이 없으면 null 참조(Visual Basic의 경우 Nothing)를 반환합니다.

설명

이 속성은 DOM(문서 개체 모델)에 대한 Microsoft 확장입니다.

적용 대상