Share via


XMLNode.XML 屬性

取得在 XMLNode 控制項中表示 XML 文字的字串。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word (在 Microsoft.Office.Tools.Word.dll 中)

語法

'宣告
ReadOnly Property XML As XMLNode_XMLType
    Get
XMLNode_XMLType XML { get; }

屬性值

型別:Microsoft.Office.Tools.Word.XMLNode_XMLType
XMLNode 控制項中表示 XML 文字的字串。

備註

XML 屬性的目的是要與下列參數一起使用。

參數

描述

ListTemplate

若要傳回沒有 Word XML 標記的 XML 文字,則為 true,否則為 false。 預設值為 false。

如果使用未指定參數的 XML 屬性,則它會傳回 XMLNode_XMLType 物件,該物件並不適合直接從您的程式碼使用。

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例使用 XML 屬性,以有和沒有 Word XML 標記的方式來顯示 XMLNode 的 XML 內容。 此範例假設目前的文件包含名為 CustomerNode 的 XMLNode

Private Sub DisplayXML()
    MsgBox("The XML of '" & Me.CustomerNode.BaseName & _
        "' without the Word markup: " & Me.CustomerNode.XML(True))

    MsgBox("The XML of '" & Me.CustomerNode.BaseName & _
        "' with the Word markup: " & Me.CustomerNode.XML(False))
End Sub
private void DisplayXML()
{
    MessageBox.Show("The XML of '" + this.CustomerNode.BaseName +
        "' without the Word markup: " + this.CustomerNode.XML[true]);

    MessageBox.Show("The XML of '" + this.CustomerNode.BaseName +
        "' with the Word markup: " + this.CustomerNode.XML[false]);
}

.NET Framework 安全性

請參閱

參考

XMLNode 介面

Microsoft.Office.Tools.Word 命名空間