public static string filePath = HttpContext.Current.Server.MapPath("~/App_Data/Messages.xml");
public static XmlDocument xmlDoc = new XmlDocument();
XmlNode _xmlNode = xmlDoc.CreateElement("category"); XmlAttribute _xmlCategoryName = xmlDoc.CreateAttribute("Name"); _xmlCategoryName.Value = categoryName; _xmlNode.Attributes.Append(_xmlCategoryName); // Add Message Node XmlElement _xmlElement = xmlDoc.CreateElement("message"); XmlAttribute _xmlId = xmlDoc.CreateAttribute("id"); _xmlId.Value = Convert.ToString(ID); _xmlElement.Attributes.Append(_xmlId); XmlAttribute _xmltitle = xmlDoc.CreateAttribute("title"); _xmltitle.Value = Convert.ToString(title); _xmlElement.Attributes.Append(_xmltitle); XmlAttribute _xmlname = xmlDoc.CreateAttribute("name"); _xmlname.Value = Convert.ToString(name); _xmlElement.Attributes.Append(_xmlname); XmlAttribute _xmlDescription = xmlDoc.CreateAttribute("Description"); _xmlDescription.Value = Convert.ToString(description); _xmlElement.Attributes.Append(_xmlDescription); _xmlNode.AppendChild(_xmlElement); xmlDoc.DocumentElement.AppendChild(_xmlNode);