private void CreateXML(string title, string Description, string date, string guid, string link)
{
string fixpath = HttpContext.Current.Server.MapPath("~\\uploads\\news\\" + title+ ".xml");
using (XmlWriter xWriter = XmlWriter.Create(fixpath))
{
xWriter.WriteStartDocument();
xWriter.WriteStartElement("News");
xWriter.WriteElementString("title", title);
xWriter.WriteElementString("date", date);
xWriter.WriteElementString("Description", Description);
xWriter.WriteElementString("link", link);
xWriter.WriteEndElement();
xWriter.WriteEndDocument();
xWriter.Flush();
xWriter.Close();
}
}
Output Will be like
<?xml version="1.0" encoding="utf-8"?>
<News>
<title>test Data</title>
<date>Wed, 15 Jun 2016 06:35:00 GMT</date>
<Description>Test Description </Description>
<link>http://www.infoa2z.com/</link>
</News>