System.Xml.XmlDocument loadDoc = new System.Xml.XmlDocument();
loadDoc.Load(Application.StartupPath + "\\用户信息表.xml"); foreach (System.Xml.XmlNode nameNode in loadDoc.SelectNodes("//UserMessage"))
{
listView1.Items.Add(nameNode.Attributes["Access文件"].InnerText); ;
}
foreach (XElement item in xDoc.Root.Descendants(“UserMessage”))
{
listView1.Items.Add(item.Attribute("Access文件").Value);
}
//引入命名空间
using System.Xml;
//加载读取节点绑定自定义方法显示页面
protected void Page_Load(object sender, EventArgs e)
XmlDocument doc = new XmlDocument();//创建并实例化一个XmlDocument对象
doc.Load(Server.MapPath("LeaveWord.xml"));//将LeaveWord.xml文件内容装载到内存
bindXml();帮定自定义方法控件显示内容
}
//自定义方法
public void bindXml()
{
XmlDocument mydoc = this.XmlDataSourceLW.GetXmlDocument();
}