XMLNode.NextSibling Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
property Microsoft::Office::Interop::Word::XMLNode ^ NextSibling { Microsoft::Office::Interop::Word::XMLNode ^ get(); };
public Microsoft.Office.Interop.Word.XMLNode NextSibling { get; }
member this.NextSibling : Microsoft.Office.Interop.Word.XMLNode
Public ReadOnly Property NextSibling As XMLNode
Property Value
A XMLNode control that represents the next element in the document that is at the same level as the specified element.
Examples
The following code example uses the PreviousSibling and NextSibling properties to display the names of the elements before and after an XMLNode control. This example assumes that the current document contains an XMLNode named CustomerFirstNameNode
.
private void DisplaySiblings()
{
// Display the previous sibling, if one exists.
if (this.CustomerFirstNameNode.PreviousSibling != null)
{
MessageBox.Show("The previous sibling of '" +
this.CustomerFirstNameNode.BaseName + "' is '" +
this.CustomerFirstNameNode.PreviousSibling.BaseName +
"'.");
}
else
{
MessageBox.Show("'" + this.CustomerFirstNameNode.BaseName +
"' is the first node in its hierarchy.");
}
// Display the next sibling, if one exists.
if (this.CustomerFirstNameNode.NextSibling != null)
{
MessageBox.Show("The next sibling of '" +
this.CustomerFirstNameNode.BaseName + "' is '" +
this.CustomerFirstNameNode.NextSibling.BaseName +
"'.");
}
else
{
MessageBox.Show("'" + this.CustomerFirstNameNode.BaseName +
"' is the last node in its hierarchy.");
}
}
Private Sub DisplaySiblings()
' Display the previous sibling, if one exists.
If Not (Me.CustomerFirstNameNode.PreviousSibling Is Nothing) Then
MsgBox("The previous sibling of '" & _
Me.CustomerFirstNameNode.BaseName & "' is '" & _
Me.CustomerFirstNameNode.PreviousSibling.BaseName & "'.")
Else
MsgBox("'" & Me.CustomerFirstNameNode.BaseName & _
"' is the first node in its hierarchy.")
End If
' Display the next sibling, if one exists.
If Not (Me.CustomerFirstNameNode.NextSibling Is Nothing) Then
MsgBox("The next sibling of '" & _
Me.CustomerFirstNameNode.BaseName & "' is '" & _
Me.CustomerFirstNameNode.NextSibling.BaseName & "'.")
Else
MsgBox("'" & Me.CustomerFirstNameNode.BaseName & _
"' is the last node in its hierarchy.")
End If
End Sub
Remarks
If the specified element is the last element in the Microsoft.Office.Tools.Word.XMLNodes collection at this level, this property returns null
.