简体   繁体   中英

Copy one Xml Document contents into another one in C#

I am trying to copy contents of one xml file into another xml file. I found many examples where copying nodes is done but could not find how to just copy all the content.

Is this possible at all? If so can you please provide some direction.

Thanks

Edit: I want to create this new xml file in the location dynamically supplied by the application's text box.

Thanks again.

如果要用另一个XML文件替换,为什么不使用File.Copy

As a file:

string sourcefile = "somefile.xml";
string destinationfile = "anotherFile.xml";
System.IO.File.Copy(sourcefile, destinationfile);

您正在寻找File.Copy()吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM