Latest web development tutorials

ASP.NET XML DocumentSource 屬性

XML 控件 XML控件

定義和用法

DocumentSource 屬性用於設置或返回在Xml 控件中顯示的XML 文檔的路徑。

語法

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

属性 描述
path 字符串值,规定 XML 文件的位置。

该属性可以是相对或绝对路径:

  • 相对路径:文件相对于当前页面位置的路径(比如 "~/note.xml")
  • 绝对路径:绝对路径(比如 "C:xmlnote.xml")


實例

實例

下面的實例設置了Xml 控件要使用的XML 文檔:

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

演示實例»

在本實例中使用的XML文件是" note.xml "。


XML 控件 XML控件