How to create Xml file with c# code?
how to create Xml file with c# code?
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.
Shankar MPosted Apr 25, 2013, 1:33 AM
Hope this will help you..
http://www.c-sharpcorner.com/Blogs/11446/extracting-xml-from-a-sql-server-using-dataset-class.aspx
Jaffreena MichaelthomasPosted Apr 18, 2013, 7:42 AM
The file gets saved inside the path specified,
-----------------------------------------------------------
if (TextBox1.Text != string.Empty)
{
string strXml = string.Empty;
strXml += "\n";
strXml += "
if (System.IO.File.Exists(Server.MapPath("~/XMLFile/" + TextBox1.Text + ".xml")))
{
System.IO.File.Delete(Server.MapPath("~/XMLFile/" + TextBox1.Text + ".xml"));
System.IO.StreamWriter file = new System.IO.StreamWriter(Server.MapPath("~/XMLFile/" + TextBox1.Text + ".xml"));
file.WriteLine(strXml);
file.Close();
file.Dispose();
}
else
{
System.IO.StreamWriter file = new System.IO.StreamWriter(Server.MapPath("~/XMLFile/" + TextBox1.Text + ".xml"));
file.WriteLine(strXml);
file.Close();
file.Dispose();
}