共用方式為


XMLNode.LoadXml Method (String)

Populates an XMLNode control with data from the specified XML string.

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

Syntax

'Declaration
Sub LoadXml ( _
    xml As String _
)
void LoadXml(
    string xml
)

Parameters

Remarks

This method does not add additional XMLNode controls or delete unnecessary XMLNode controls from the document.

This method updates all attributes of the XMLNode control.

Examples

The following code example uses the LoadXml method to fill an XMLNode control with data from an XML string. This example assumes that the current document contains an XMLNode named CustomerNode, and the namespace and elements described in the XML string conform to the schema associated with CustomerNode.

Private Sub LoadXmlFromString()
    Me.CustomerNode.LoadXml( _
        "<Customer xmlns='http://tempuri.org/XMLNodeVBCustomers.xsd'>" & _
        "<LastName>Smith</LastName></Customer>")
End Sub
private void LoadXmlFromString()
{
    this.CustomerNode.LoadXml(
        "<Customer xmlns='http://tempuri.org/XMLNodeCSCustomers.xsd'>" +
        "<LastName>Smith</LastName></Customer>");
}

.NET Framework Security

See Also

Reference

XMLNode Interface

LoadXml Overload

Microsoft.Office.Tools.Word Namespace