2012-12-07 115 views

回答

3

您可以使用LINQ到XML XElement.ReplaceWith方法

// select node from one doc 
XDocument xdoc1 = XDocument.Load(path_to_doc1);  
XElement one = xdoc1.Descendants("One").First(); 

// select node from another doc 
XDocument xdoc2 = XDocument.Load(path_to_doc2); 
XElement another = xdoc2.Descendants("Another").First(); 

// replace one xml node with another 
one.ReplaceWith(another); 
xdoc1.Save(path_to_doc1); 
+0

谢谢先生。 – MuraliKrishna

相关问题