共用方式為


XMLNode.Load Method

Updates an XMLNode control with data from the specified XML file

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

Syntax

'Declaration
Sub Load ( _
    fileName As String _
)
void Load(
    string fileName
)

Parameters

  • fileName
    Type: System.String

    The path to the file from which to read the XML.

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 Load method to fill an XMLNode with data from an XML file. This example assumes that the current document contains an XMLNode named CustomerNode. This example also assumes that an XML file named Customers.xml, which conforms to the schema associated with CustomerNode, exists at the root of the D directory.

Private Sub LoadXmlFromFilename()
    Dim xmlPath As String = "D:\Customers.xml" 
    Me.CustomerNode.Load(xmlPath)
End Sub
private void LoadXmlFromFilename()
{
    string xmlPath = @"D:\Customers.xml";
    this.CustomerNode.Load(xmlPath);
}

.NET Framework Security

See Also

Reference

XMLNode Interface

Microsoft.Office.Tools.Word Namespace