Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add a root element using xmldocument in C#.net

Tags:

c#

xmldocument

I need to create an XML file using an xmldocument object in C#.

How can I add a root element like:

 book:aaaa xsi:schemalocationchemaLocation="http://www.com"
like image 863
Rakesh kumar Avatar asked Jun 18 '10 13:06

Rakesh kumar


1 Answers

XmlDocument doc = new XmlDocument();
XmlElement elem = doc.CreateElement("book", "aaaa", "http://www.com");
doc.AppendChild(elem);
like image 182
Matthias Avatar answered Oct 13 '22 10:10

Matthias