This documentation is archived and is not being maintained.

XmlLinkedNode.NextSibling Property

Gets the node immediately following this node.

[Visual Basic]
Overrides Public ReadOnly Property NextSibling As XmlNode
[C#]
public override XmlNode NextSibling {get;}
[C++]
public: __property XmlNode* get_NextSibling();
[JScript]
public override function get NextSibling() : XmlNode;

Property Value

The XmlNode immediately following this node or a null reference (Nothing in Visual Basic) if one does not exist.

Example

[Visual Basic, C#, C++] The following example displays the first two book nodes.

[Visual Basic] 

 Imports System
 Imports System.IO
 Imports System.Xml
 
 public class Sample
 
   public shared sub Main()
   
       Dim doc as XmlDocument = new XmlDocument()
       doc.Load("books.xml")

       '  Display the first two book nodes
       Dim book as XmlNode = doc.DocumentElement.FirstChild
       Console.WriteLine(book.OuterXml)
       Console.WriteLine()
       Console.WriteLine(book.NextSibling.OuterXml)

   end sub
 end class

[C#] 
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {

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

     // Display the first two book nodes.
     XmlNode book = doc.DocumentElement.FirstChild;
     Console.WriteLine(book.OuterXml);
     Console.WriteLine();
     Console.WriteLine(book.NextSibling.OuterXml);

  }
}

[C++] 
#using <mscorlib.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
 
int main()
{
      XmlDocument* doc = new XmlDocument();
      doc->Load(S"books.xml");
 
      // Display the first two book nodes.
      XmlNode* book = doc->DocumentElement->FirstChild;
      Console::WriteLine(book->OuterXml);
      Console::WriteLine();
      Console::WriteLine(book->NextSibling->OuterXml);
};

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

XmlLinkedNode Class | XmlLinkedNode Members | System.Xml Namespace | PreviousSibling

Show: