国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

如何讀取XML文件內容

2019-11-18 16:54:59
字體:
來源:轉載
供稿:網友

下面是通過讀取xml文件中的內容并顯示在textbox的例子:


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.XPath;

public partial class _Default : System.Web.UI.Page
{
    public string[] x = new string[4];
    PRotected void Page_Load(object sender, EventArgs e)
    {

        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load(Server.MapPath("table.xml"));//你的xml文件
        XmlNodeList xmlList = xmlDoc.SelectSingleNode("MapSheet").ChildNodes;
        foreach (XmlNode xmlNo in xmlList)
        {
            //XmlNodeList xe = (XmlNodeList)xmlNo;
            XmlElement xe = (XmlElement)xmlNo;
            {
                if (xe.Name == "TableName")
                {
                    y[0] = xe.InnerText;
                }

                if (xe.Name == "DataSource")
                {
                    y[1] = xe.InnerText;
                }

                if (xe.Name == "UserName")
                {
                    y[2] = xe.InnerText;
                }

                if (xe.Name == "PassWord")
                {
                    y[3] = xe.InnerText;
                }
            }
        }
        TextBox1.Text=y[0];
        TextBox2.Text = y[1];
        TextBox3.Text = y[2];
        TextBox4.Text = y[3];
    }


}該程序已經過測試,沒有問題。
http://m.survivalescaperooms.com/support/archive/2006/10/21/535967.html


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大宁县| 兴山县| 北宁市| 攀枝花市| 永康市| 剑河县| 平塘县| 关岭| 内黄县| 新郑市| 尼玛县| 肃宁县| 汨罗市| 山阳县| 板桥市| 栾川县| 丹江口市| 青神县| 桂阳县| 大余县| 抚州市| 和林格尔县| 鸡东县| 西乌| 耒阳市| 万盛区| 南华县| 庄河市| 宜黄县| 无棣县| 小金县| 息烽县| 茂名市| 云龙县| 喀什市| 酒泉市| 自治县| 增城市| 仁布县| 申扎县| 永平县|