【发布时间】:2013-01-23 01:00:09
【问题描述】:
我有这个 xml 文件:http://www.studiovincent.net/list.xml
我需要将整个内容复制到其他 xml 文件中。
我试过这段代码:
string sourcefile = "http://www.studiovincent.net/list.xml";
string destinationfile = "test.xml";
System.IO.File.Copy(sourcefile, destinationfile);
但不起作用,因为我收到此错误:不支持 URI 格式。
我该如何解决这个问题?
【问题讨论】:
-
text.xml的文件路径是什么你试过用完整的文件路径复制它吗
-
test.xml 在应用程序路径中
-
您不能使用
File.Copy从URL复制文件,您需要使用WebClient或类似的方式下载文件,然后将其复制到另一个位置(如果需要) .
标签: c# xml xml-parsing