Freigeben über


XmlNode.NextSibling-Eigenschaft

Ruft den Knoten ab, der diesem Knoten unmittelbar folgt.

Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)

Syntax

'Declaration
Public Overridable ReadOnly Property NextSibling As XmlNode
'Usage
Dim instance As XmlNode
Dim value As XmlNode

value = instance.NextSibling
public virtual XmlNode NextSibling { get; }
public:
virtual property XmlNode^ NextSibling {
    XmlNode^ get ();
}
/** @property */
public XmlNode get_NextSibling ()
public function get NextSibling () : XmlNode

Eigenschaftenwert

Der nächste XmlNode. Wenn kein nächster Knoten vorhanden ist, wird NULL (Nothing in Visual Basic) zurückgegeben.

Beispiel

Im folgenden Beispiel werden alle Bücher im XML-Dokument angezeigt.

Imports System
Imports System.Xml
Imports Microsoft.VisualBasic

public class Sample 

  public shared sub Main() 

      Dim doc as XmlDocument = new XmlDocument()
      doc.Load("books.xml")

      Dim currNode as XmlNode = doc.DocumentElement.FirstChild
      Console.WriteLine("First book...")
      Console.WriteLine(currNode.OuterXml)

      Dim nextNode as XmlNode = currNode.NextSibling
      Console.WriteLine(ControlChars.LF + "Second book...")
      Console.WriteLine(nextNode.OuterXml) 

  end sub
end class
using System;
using System.Xml;

public class Sample {

  public static void Main() {

      XmlDocument doc = new XmlDocument();
      doc.Load("books.xml");

      XmlNode currNode = doc.DocumentElement.FirstChild;
      Console.WriteLine("First book...");
      Console.WriteLine(currNode.OuterXml);

      XmlNode nextNode = currNode.NextSibling;
      Console.WriteLine("\r\nSecond book...");
      Console.WriteLine(nextNode.OuterXml); 

  }
}
#using <System.Xml.dll>

using namespace System;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->Load( "books.xml" );
   XmlNode^ currNode = doc->DocumentElement->FirstChild;
   Console::WriteLine( "First book..." );
   Console::WriteLine( currNode->OuterXml );
   XmlNode^ nextNode = currNode->NextSibling;
   Console::WriteLine( "\r\nSecond book..." );
   Console::WriteLine( nextNode->OuterXml );
}
import System.*;
import System.Xml.*;

public class Sample
{
    public static void main(String[] args)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load("books.xml");

        XmlNode currNode = doc.get_DocumentElement().get_FirstChild();
        Console.WriteLine("First book...");
        Console.WriteLine(currNode.get_OuterXml());

        XmlNode nextNode = currNode.get_NextSibling();
        Console.WriteLine("\r\nSecond book...");
        Console.WriteLine(nextNode.get_OuterXml());
    } //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

XmlNode-Klasse
XmlNode-Member
System.Xml-Namespace