XmlNode.NextSibling Property


Gets the node immediately following this node.

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

public virtual XmlNode NextSibling { get; }

Property Value

Type: System.Xml.XmlNode

The next XmlNode. If there is no next node, null is returned.

The following example displays all the books in the XML document.

using System;
using System.Xml;

public class Sample {

  public static void Main() {

      XmlDocument doc = new XmlDocument();

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

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


Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top