try
{
XmlDocument doc = new XmlDocument();
string result = @ " <a> <b> <c> asdfsdf </c> </b> </a> ";
doc.LoadXml(result);
doc.Save( "2.xml ");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message+ex.StackTrace);
}
}
public void GetWetheaerByCity(string cityName)
{
string city = cityName;
string mycity = HttpUtility.UrlEncode(city, System.Text.Encoding.GetEncoding("GB2312"));
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.sina.com/index.php?city=" + cityName);
//HttpWebRequest 对象 获取GetResponse 转换成HttpWebResponse
System.Net.HttpWebResponse response = request.GetResponse() as System.Net.HttpWebResponse;
//通过HttpWebResponse response.GetResponseStream()获取输出流
Stream str = response.GetResponseStream();
StreamReader reader = new StreamReader(str, System.Text.Encoding.GetEncoding("GB2312"));
string weathhtml = reader.ReadToEnd();
str.Close();
reader.Close();
}
<iframe id="weather" src="http://m.weather.com.cn/m/pn1/weather.htm" frameborder="0" scrolling="no" allowTransparency="true"></iframe>