日期:2014-05-17 浏览次数:20943 次
XmlDocument doc = new XmlDocument();
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "GB2312", null);
doc.AppendChild(dec);
XmlNode root = doc.CreateElement("First");
XmlNode node = doc.CreateElement("Second");
root.AppendChild(node);
XmlElement element1 = doc.CreateElement("WaterFee");
element1.InnerText = ”111“;
node.AppendChild(element1);
doc.AppendChild(root);
doc.Save(@"D:\Fee.xml");
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"D:\Fee.xml");
XmlNode node = doc.SelectSingleNode("First/second/WaterFee");
WaterFee = node.InnerText;