Create XML file in mentioned path
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sukesh MarlaRank #461 · 5.4K reputationPosted Aug 22, 2012, 9:18 PM EDT
XmlDocument Document = new XmlDocument();
XmlElement Root = Document.CreateElement("C-sHarpCorner");
Root.SetAttribute("Att1", "AttValue");
Document.AppendChild(Root);
XmlElement element1 = Document.CreateElement("Element1");
Root.AppendChild(element1);
XmlElement element11 = Document.CreateElement("Value1");
element11.InnerText = "Sukesh";
element1.AppendChild(element11);
element11 = Document.CreateElement("Value2");
element11.InnerText = "Marla";
element1.AppendChild(element11);
Document.Save(@"C:\test.xml");
Check this is corerct answer if it helped
Sheethal R A11 reputationPosted Aug 22, 2012, 9:38 PM EDT
Actually I have a config file in my installation path. I need to create one more copy of it.
It means I have an object of config file and I need to copy the same to create another xml file in the same path.