tags:

views:

89

answers:

3

hi all, how to add element to a xml file using asp.net& c#.net inweb application

A: 

Load the document using XmlDocument class and then modify it as needed. Reference documentation and examples here.

axel_c
+1  A: 

Here's an example of adding a new element to the root node:

XDocument doc = XDocument.Load("test.xml");
doc.Root.Add(new XElement("someNode", "some node value"));
doc.Save("test.xml");
Darin Dimitrov
A: 

You can use XmlDocument.CreateElement method to create it and then to append it

Svetlozar Angelov