共用方式為


XMLNode.XML Property

Gets a string that represents the XML text in the XMLNode control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
ReadOnly Property XML As XMLNode_XMLType
XMLNode_XMLType XML { get; }

Property Value

Type: Microsoft.Office.Tools.Word.XMLNode_XMLType
A string that represents the XML text in the XMLNode control.

Remarks

The XML property is intended to be used with the following parameter.

Parameter

Description

ListTemplate

true to return the text of the XML without the Word XML markup; otherwise, false. The default is false.

If you use the XML property without specifying a parameter, it returns an XMLNode_XMLType object that is not intended to be used directly from your code.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the XML property to display the XML contents of an XMLNode with and without the Word XML markup. This example assumes that the current document contains an XMLNode named CustomerNode.

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 Security

See Also

Reference

XMLNode Interface

Microsoft.Office.Tools.Word Namespace