Nyelv

XmlNode.Item[] Tulajdonság

Definíció

Lekéri a megadott gyermekelemet.

Túlterhelések

Név Description
Item[String]

Lekéri az első gyermekelemet a megadott Name.

Item[String, String]

Lekéri az első gyermekelemet a megadott LocalName és NamespaceURIa .

Item[String]

Forrás:
XmlNode.cs
Forrás:
XmlNode.cs
Forrás:
XmlNode.cs
Forrás:
XmlNode.cs
Forrás:
XmlNode.cs

Lekéri az első gyermekelemet a megadott 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

Paraméterek

name
String

A lekérni kívánt elem minősített neve.

Tulajdonság értéke

Az első XmlElement , amely megfelel a megadott névnek. Null hivatkozást ad vissza (Nothing Visual Basic), ha nincs egyezés.

Példák

Az alábbi példa a címelemet jeleníti meg.

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

Megjegyzések

Ez a tulajdonság a Dokumentumobjektum-modell (DOM) Microsoft bővítménye.

A következőre érvényes:

Item[String, String]

Forrás:
XmlNode.cs
Forrás:
XmlNode.cs
Forrás:
XmlNode.cs
Forrás:
XmlNode.cs
Forrás:
XmlNode.cs

Lekéri az első gyermekelemet a megadott LocalName és NamespaceURIa .

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

Paraméterek

localname
String

Az elem helyi neve.

ns
String

Az elem névterének URI-ja.

Tulajdonság értéke

Az első XmlElement a megfelelő localname és ns. Null hivatkozást ad vissza (Nothing Visual Basic), ha nincs egyezés.

Megjegyzések

Ez a tulajdonság a Dokumentumobjektum-modell (DOM) Microsoft bővítménye.

A következőre érvényes: