本文介绍了如何附加到xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨大家好 好吧问题是这样我有以下代码Hi GuysWell the problem is like this i have the following codeXmlTextWriter writer = new XmlTextWriter("D:\\Grop.xml", System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartElement("Table"); //calling the createNode method createNode("123", "3232", "43234","A string of text 1",DateTime.Now.ToString(), writer); createNode("123", "3232", "43234", "A string of text 2", DateTime.Now.ToString(), writer); createNode("123", "3232", "43234", "A string of text 3", DateTime.Now.ToString(), writer); createNode("123", "3232", "43234", "A string of text 4", DateTime.Now.ToString(), writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); //创建节点方法//the create node methodprivate void createNode(string stud_Id, string post_Id, string group_Id,string desc, string postdate, XmlTextWriter writer) { writer.WriteStartElement("Post"); writer.WriteStartElement("Student_ID"); writer.WriteString(stud_Id); writer.WriteEndElement(); writer.WriteStartElement("Group_ID"); writer.WriteString(group_Id); writer.WriteEndElement(); writer.WriteEndElement(); } 问题是上面的代码没有附加到xml文件,每次我编译代码时它只会覆盖文件的内容。每次编译和运行代码时如何附加? 提前致谢The problem is this the code above doesnt append to the xml file,it only overwrites the contents of the file everytime i complie the code. How do I get to append each time I compile and run the code?Thanks in advance推荐答案 这篇关于如何附加到xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 20:37