标签:
private void SaveXML() { FileInfo fileInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "list.xml"); if (fileInfo.Exists) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "list.xml"); XmlNode xmlNode = xmlDocument.SelectSingleNode("Lists"); XmlNodeList xmlNodeList = xmlNode.SelectNodes("List"); foreach (XmlNode node in xmlNodeList) { XmlElement element = (XmlElement)node; element["Time"].InnerText = "12341"; } xmlDocument.Save(AppDomain.CurrentDomain.BaseDirectory + "list.xml"); } }
private void GetXML() { FileInfo fileInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "list.xml"); if (fileInfo.Exists) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "list.xml"); XmlNode xmlNode = xmlDocument.SelectSingleNode("Lists"); XmlNodeList nodes = xmlNode.SelectNodes("List"); foreach (XmlNode node in nodes) { XmlElement element = (XmlElement)node; string str = element["Time"].InnerText; MessageBox.Show(str); } } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/ilipan/article/details/48006477