Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
3230 Points
668 Posts
May 04, 2012 09:26 AM|LINK
using System.Xml; public partial class Default13 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); // XML declaration XmlNode declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(declaration); // Root element: article XmlElement root = doc.CreateElement("Record"); root.InnerText = "This is root element"; doc.AppendChild(root); doc.Save(Server.MapPath("~\\temp.xml")); } }
hi,
tusharrs
Contributor
3230 Points
668 Posts
Re: Write in XML File Dynamically
May 04, 2012 09:26 AM|LINK
using System.Xml; public partial class Default13 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); // XML declaration XmlNode declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(declaration); // Root element: article XmlElement root = doc.CreateElement("Record"); root.InnerText = "This is root element"; doc.AppendChild(root); doc.Save(Server.MapPath("~\\temp.xml")); } }hi,
( Mark as Answer if it helps you out )
View my Blog