我无法从http://158.58.185.214/Applications/Operator/Files/Data/Bus/CityList.xml
读取xml字符串,我认为编码是问题,请帮助解决。
我的代码是:
string url = "http://158.58.185.214/Applications/Operator/Files/Data/Bus/CityList.xml";
WebClient client = new WebClient();
string xml = client.DownloadString(url);
但是xml字符串是:
‹ í½`I–%&/mÊ{JõJ×àt¡€`$Ø@ìÁˆÍæ’ìiG#....
答案 0 :(得分:-1)
你的问题可以像这样解决
使用System.Xml;
String URLString = " http://localhost/books.xml";
XmlTextReader reader = new XmlTextReader (URLString);
while (reader.Read())
{
// Do some work here on the data.
Console.WriteLine(reader.Name);
}
Console.ReadLine();