Share via


XMLNode.Load(String) Method

Definition

Updates an XMLNode control with data from the specified XML file

public:
 void Load(System::String ^ fileName);
public void Load (string fileName);
abstract member Load : string -> unit
Public Sub Load (fileName As String)

Parameters

fileName
String

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

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 void LoadXmlFromFilename()
{
    string xmlPath = @"D:\Customers.xml";
    this.CustomerNode.Load(xmlPath);
}
Private Sub LoadXmlFromFilename()
    Dim xmlPath As String = "D:\Customers.xml"
    Me.CustomerNode.Load(xmlPath)
End Sub

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.

Applies to