在C#.net中使用xmldocument添加根元素

Rak*_*mar 9 c# xmldocument

我需要在C#中使用xmldocument对象创建XML文件.

如何添加如下的根元素:

 book:aaaa xsi:schemalocationchemaLocation="http://www.com"
Run Code Online (Sandbox Code Playgroud)

Mat*_*ias 16

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