ASP.NET DocumentSource property

Definition and usage

The DocumentSource property is used to set or return the path of the XML document displayed in the Xml control.

Syntax

<asp:Xml DocumentSource="path" runat="server" />
Property Description
path

String value, specifying the location of the XML file.

This property can be relative or absolute:

  • Relative path: the file path is relative to the current page (for example: "~/note.xml")
  • Absolute path: for example: "C:\xml\note.xml"

Example

The following example sets the DocumentSource of the Xml control:

<form runat="server">
<asp:Xml id="xml1" runat="server" DocumentSource="note.xml" />
</form>

The XML file used in examples and TIY is "note.xml".

Example

Set XML document source for XML controls