0
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateElement("Foo"));
doc.DocumentElement.InnerXml = "Test";
StringBuilder result = new StringBuilder();
doc.WriteContentTo(XmlWriter.Create(result));
在結束時,結果是:爲XmlDocument的設定InnerXml導致缺失結束標籤
<Foo>Test
,這意味着端部元件缺失。爲什麼是這樣的,我該如何解決它?