XMLNode.NextSibling Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
public Microsoft.Office.Interop.Word.XMLNode NextSibling { get; }
Valor da propriedade
Um controle XMLNode que representa o próximo elemento no documento que está no mesmo nível que o elemento especificado.
Exemplos
O exemplo de código a seguir usa as PreviousSibling NextSibling Propriedades e para exibir os nomes dos elementos antes e depois de um XMLNode controle. Este exemplo pressupõe que o documento atual contenha um XMLNode chamado 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
Comentários
Se o elemento especificado for o último elemento na Microsoft.Office.Tools.Word.XMLNodes coleção nesse nível, essa propriedade retornará null .