Rakesh kumar
Rakesh kumar

Reputation: 121

add a root element using xmldocument in C#.net

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"

Upvotes: 12

Views: 19966

Answers (1)

Matthias
Matthias

Reputation: 1032

XmlDocument doc = new XmlDocument();
XmlElement elem = doc.CreateElement("book", "aaaa", "http://www.com");
doc.AppendChild(elem);

Upvotes: 19

Related Questions