sir,
i am implementing Asp.Net in my project and new to xml database
i have web form which contains firstname and lastname and address and etc,...
whenever i am submit this page it will store on sql database and also xml database
i done sql database storage but i dont know how to add data to xml file.
Please help me
With Thanks
S.Senthil Nathan
hi senthil...
r u trying to write some data to an xml file?
then u can use some classes like XmlTextWriter and XmlDocument
here is d C# sample code...
String filename = Server.MapPath("temp.xml"); //to create an xml file in d current directory...
XmlTextWriter xwriter = new XmlTextWriter(filename , Encoding.UTF8);
XmlDocument xmldoc = new XmlDocument() ;
xwriter.WriteStartDocument();
xwriter.WriteStartElement("Root");
xwriter.WriteEndDocument();
xwriter.Close();
xmldoc.Load(filename);
XmlElement e1 = xmldoc.CreateElement("Element1");
xmldoc.DocumentElement.AppendChild(e1);
XmlElement e2 = xmldoc.CreateElement("Element2");
e2.InnerText = "Element2-text";
e1.AppendChild(e2);
XmlElement e3 = xmldoc.CreateElement("Element3");
e3.InnerText = "Element3-text";
e1.AppendChild(e3);
XmlElement e4 = xmldoc.CreateElement("Element4");
e4.InnerText = "Element4-text";
e1.AppendChild(e4);
xmldoc.Save(filename);
hope this helps...
thanx and rgrds,
sand...