XmlNode::NextSibling Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the node immediately following this node.

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

property XmlNode^ NextSibling {
	virtual XmlNode^ 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.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 );

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