XMLNode.NodeType Özellik
Belirten bir değer alır mı bir XMLNode bir öznitelik veya öğe.
Ad alanı: Microsoft.Office.Tools.Word
Derleme: Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)
Sözdizimi
'Bildirim
ReadOnly Property NodeType As WdXMLNodeType
WdXMLNodeType NodeType { get; }
Özellik Değeri
Tür: Microsoft.Office.Interop.Word.WdXMLNodeType
Biri WdXMLNodeType düğüm türünü gösteren değer.
Notlar
NodeType Özelliği aşağıdakilerden biri olabilir WdXMLNodeType değerleri:
wdXMLNodeAttributebir öznitelik düğümü gösterir.
wdXMLNodeElementbir öğe düğümü gösterir.
Kullanım NodeType çalıştığınız düğümü geçersiz işlemleri çalışmayın, düğüm türünü belirlemek için özellik.Örneğin, Attributes özelliği, yalnızca öğe düğümleri için kullanılabilir özellikler listesinde görünse de uygulanır XMLNode denetim.
Örnekler
Aşağıdaki kod örneğinde NodeType belirlemek için özellik olup olmadığını bir XMLNode bir öğe veya öznitelik düğümü.Yoksa XMLNode bir öğe, örnek kullanımları NodeText öğenin metnini ayarlamak için özellik.Yoksa XMLNode , örnek kullanımları özniteliğidir NodeValue öznitelik değerini ayarlamak için özellik.Bu örnek, geçerli belgenin CustomerLastNameNode adında bir XMLNode içerdiğini varsaymaktadır.
Private Sub DisplayNodeDetails()
If Me.CustomerLastNameNode.NodeType = _
Word.WdXMLNodeType.wdXMLNodeElement Then
Me.CustomerLastNameNode.NodeText = "Smith"
MsgBox("The element '" & Me.CustomerLastNameNode.BaseName & _
"' has the text '" & Me.CustomerLastNameNode.NodeText & "'.")
ElseIf Me.CustomerLastNameNode.NodeType = _
Word.WdXMLNodeType.wdXMLNodeAttribute Then
Me.CustomerLastNameNode.NodeValue = "Smith"
MsgBox("The attribute '" & Me.CustomerLastNameNode.BaseName & _
"' has the value '" & Me.CustomerLastNameNode.NodeValue & "'.")
End If
End Sub
private void DisplayNodeDetails()
{
if (this.CustomerLastNameNode.NodeType ==
Word.WdXMLNodeType.wdXMLNodeElement)
{
this.CustomerLastNameNode.NodeText = "Smith";
MessageBox.Show("The element '" +
this.CustomerLastNameNode.BaseName + "' has the text '" +
this.CustomerLastNameNode.NodeText + "'.");
}
else if (this.CustomerLastNameNode.NodeType ==
Word.WdXMLNodeType.wdXMLNodeAttribute)
{
this.CustomerLastNameNode.NodeValue = "Smith";
MessageBox.Show("The attribute '" +
this.CustomerLastNameNode.BaseName + "' has the value '" +
this.CustomerLastNameNode.NodeValue + "'.");
}
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.