📄 xmldatadocument.aspx
字号:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<script runat=server>
void Page_Load(Object sender , EventArgs e)
{
DataSet dstRecipes;
XmlDataDocument objDataDocument;
XmlNodeList objRecipes;
dstRecipes = new DataSet();
dstRecipes.ReadXml( MapPath( "Recipes.xml" ) );
objDataDocument = new XmlDataDocument( dstRecipes );
objRecipes = objDataDocument.GetElementsByTagName( "Ingredient" );
foreach ( XmlNode objRecipe in objRecipes)
{
lblOutput.Text += objRecipe.InnerXml;
}
}
</Script>
<html>
<head><title>XmlDataDocument.aspx</title></head>
<body>
<h2>All Ingredients</h2>
<asp:Label
ID="lblOutput"
Runat="Server" />
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -