C#操作XML
2010-02-02 16:19 爱研究源码的javaer 阅读(240) 评论(0) 编辑 收藏 举报代码
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(Application.StartupPath + "\\" + "DGVFormatFiles\\MenuForm.grdDefault.xml");
//System.Xml.XmlNodeReader xmlRd = new System.Xml.XmlNodeReader(xmlDoc);
System.Xml.XmlNode xn = xmlDoc.SelectSingleNode("DataGridView");
System.Xml.XmlNodeList xnxnl=xn.ChildNodes;
foreach(System.Xml.XmlNode xnf in xnxnl)
{
System.Xml.XmlElement xe=(System.Xml.XmlElement)xnf;
string strName = xe.GetAttribute("Name");
string strHeaderText = xe.GetAttribute("HeaderText");
}
xmlDoc.Load(Application.StartupPath + "\\" + "DGVFormatFiles\\MenuForm.grdDefault.xml");
//System.Xml.XmlNodeReader xmlRd = new System.Xml.XmlNodeReader(xmlDoc);
System.Xml.XmlNode xn = xmlDoc.SelectSingleNode("DataGridView");
System.Xml.XmlNodeList xnxnl=xn.ChildNodes;
foreach(System.Xml.XmlNode xnf in xnxnl)
{
System.Xml.XmlElement xe=(System.Xml.XmlElement)xnf;
string strName = xe.GetAttribute("Name");
string strHeaderText = xe.GetAttribute("HeaderText");
}
读取配置好的XML文件中的信息
操作XML 资料:http://book.51cto.com/art/201002/181903.htm
http://www.cnblogs.com/chenou/articles/1158654.html
http://hi.baidu.com/%D3%F7%D0%C4/blog/item/76b7ea1725cd090b4a90a7c3.html