Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft den Knoten am angegebenen Index in der XmlNamedNodeMap ab.
Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)
Syntax
'Declaration
Public Overridable Function Item ( _
index As Integer _
) As XmlNode
'Usage
Dim instance As XmlNamedNodeMap
Dim index As Integer
Dim returnValue As XmlNode
returnValue = instance.Item(index)
public virtual XmlNode Item (
int index
)
public:
virtual XmlNode^ Item (
int index
)
public XmlNode Item (
int index
)
public function Item (
index : int
) : XmlNode
Parameter
- index
Die Indexposition des aus der XmlNamedNodeMap abzurufenden Knotens. Der Index ist nullbasiert. Daher ist der Index des ersten Knotens 0 und der des letzten Knotens Count -1.
Rückgabewert
Der XmlNode am angegebenen Index. Wenn index kleiner als 0 oder größer oder gleich der Count-Eigenschaft ist, wird NULL (Nothing in Visual Basic) zurückgegeben.
Beispiel
Im folgenden Beispiel werden mit der XmlAttributeCollection-Klasse (die von XmlNamedNodeMap erbt) alle Attribute eines Buches angezeigt.
Imports System
Imports System.IO
Imports System.Xml
public class Sample
public shared sub Main()
Dim doc as XmlDocument = new XmlDocument()
doc.LoadXml("<book genre='novel' publicationdate='1997'> " & _
" <title>Pride And Prejudice</title>" & _
"</book>")
Dim attrColl as XmlAttributeCollection = doc.DocumentElement.Attributes
Console.WriteLine("Display all the attributes for this book...")
Dim i As Integer
For i = 0 To attrColl.Count - 1
Console.WriteLine("{0} = {1}", attrColl.Item(i).Name,attrColl.Item(i).Value)
Next
end sub
end class
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' publicationdate='1997'> " +
" <title>Pride And Prejudice</title>" +
"</book>");
XmlAttributeCollection attrColl = doc.DocumentElement.Attributes;
Console.WriteLine("Display all the attributes for this book...");
for (int i=0; i < attrColl.Count; i++)
{
Console.WriteLine("{0} = {1}", attrColl.Item(i).Name, attrColl.Item(i).Value);
}
}
}
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
XmlDocument^ doc = gcnew XmlDocument;
doc->LoadXml( "<book genre='novel' publicationdate='1997'> <title>Pride And Prejudice</title></book>" );
XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
Console::WriteLine( "Display all the attributes for this book..." );
for ( int i = 0; i < attrColl->Count; i++ )
{
Console::WriteLine( "{0} = {1}", attrColl->Item( i )->Name, attrColl->Item( i )->Value );
}
}
import System.*;
import System.IO.*;
import System.Xml.*;
public class Sample
{
public static void main(String[] args)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' publicationdate='1997'> "
+ " <title>Pride And Prejudice</title>"
+ "</book>");
XmlAttributeCollection attrColl =
doc.get_DocumentElement().get_Attributes();
Console.WriteLine("Display all the attributes for this book...");
for (int i = 0; i < attrColl.get_Count(); i++) {
Console.WriteLine("{0} = {1}", attrColl.Item(i).get_Name(),
attrColl.Item(i).get_Value());
}
} //main
} //Sample
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
XmlNamedNodeMap-Klasse
XmlNamedNodeMap-Member
System.Xml-Namespace