通过XML节点名称取值

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Xml;



public partial class _Default : System.Web.UI.Page

{

     protected void Page_Load(object sender, EventArgs e)

     {

           XmlDocument doc = new XmlDocument();//创建xml文档对象

         doc.Load(Server.MapPath("XMLFile.xml"));

           XmlNodeList list = doc.GetElementsByTagName("WebName");//事实证明可以准确找到填写的节点

         Response.Write(list[0].InnerText);//自己测试

     }

}

 

你可能感兴趣的:(xml)