Aracılığıyla paylaş


XMLNode.NodeValue Özellik

Alır veya ayarlar bir XMLNode , bir özniteliği temsil eder.

Ad alanı:  Microsoft.Office.Tools.Word
Derleme:  Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)

Sözdizimi

'Bildirim
Property NodeValue As String
string NodeValue { get; set; }

Özellik Değeri

Tür: System.String
Değeri XMLNode , bir özniteliği temsil eder.

Notlar

Use NodeType birlikte çalıştığınız düğüm türünü belirlemek için özellik.

İçin XMLNode ile denetleyen bir NodeType değeri wdXMLNodeElement, NodeValue özelliği hiçbir şey verir.

Örnekler

Aşağıdaki kod örneği NodeType belirlemek için özellik olup bir XMLNode bir öðe ya da öznitelik düğümü.XMLNode Bir öğe, örnek kullanımlar NodeText öğesinde metni ayarlamak için özellik.XMLNode Özniteliği örnek kullanımlar NodeValue öznitelik değerini ayarlamak için özellik.Bu örnek, geçerli belge içerdiğini varsayar bir XMLNode adlı CustomerLastNameNode.

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

Ayrıca bkz.

Başvuru

XMLNode Arabirim

Microsoft.Office.Tools.Word Ad Alanı