2
我加載XML文檔的另一個文檔的節點:添加XML節點從文件
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("MyFile.xml");
,也可以創建一個新的文件:
XmlDocument xmlDocSettings = new XmlDocument();
XmlNode xmlDecl = xmlDocSettings.CreateNode(XmlNodeType.XmlDeclaration, "", "");
xmlDocSettings.AppendChild(xmlDecl);
XmlElement root = xmlDocSettings.CreateElement("", "Test", "");
root.SetAttribute("TestAttribute", "AttributeValue");
xmlDocSettings.AppendChild(root);
現在我想插入的內容xmlDoc
至xmlDocSettings
。我怎樣才能做到這一點?
謝謝!