Create XML file in mentioned path
Create XML file in mentioned path
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sheethal R APosted Aug 23, 2012, 1:38 AM
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.
Sukesh MarlaPosted Aug 23, 2012, 1:18 AM
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