For creating dynamic xml file you need to import System.Xml namespace
Private void CreateXmlFile()
{
// Creating XML with saving file location
XmlTextWriter xmlWriter = new XmlTextWriter(Server.MapPath(".") "propertydetails.xml", System.Text.Encoding.UTF8);
xmlWriter.WriteStartDocument();
//For Creating XML Root Element
xmlWriter.WriteStartElement("RootElemet");
//For Creating ChildXMlNode
xmlWriter.WriteStartElement("ChildNode");
//For Creating XMLSubChildNode
xmlWriter.WriteElementString("SubChildNode", "TextforSubChildNode");
// Closing XMLChildNodexmlWriter.WriteEndElement();// Closing XMLChildNode
// Closing XMLRootNode
xmlWriter.WriteEndDocument();
//Closing File
xmlWriter.Close();
}
0 comments:
Post a Comment