读取xml 文件


 using System;
 using System.Data;
 using System.Drawing;
 using System.Web;
 using System.Web.UI.WebControls;
 using System.Web.UI.HtmlControls;
 using System.Xml;

 /// <summary>
 ///  Summary description for Mean.
 /// </summary>
 public class Mean : System.Web.UI.UserControl
 {

  private void Page_Load(object sender, System.EventArgs e)
  {
   // Put user code to initialize the page here
   //加载XML文件
   XmlTextReader dr = new XmlTextReader(Server.MapPath("Mean.xml"));
   dr.WhitespaceHandling =WhitespaceHandling.Significant;
   while(dr.Read())
    if (dr.NodeType==XmlNodeType.Element)
     //输出节点
     Response.Write(dr.GetAttribute("tnfamfe")+ "<a href=" + dr.GetAttribute("ufrl") + " target=FramfeMain>" +dr.GetAttribute("nfamfe") +"</a></br>");

   dr.Close ();
  

  }

阅读更多
换一批

没有更多推荐了,返回首页