<?xml version="1.0" encoding="gb2312" ?>
<xml>
<row digit="2010112565" atime="21:58" anum="03 01 08 05 09" />
<row digit="2010112564" atime="21:46" anum="05 01 03 11 04" /> </xml>上面这一段是我从一个网页中读取出来的一个字符串,我现在想把他直接保存成xml该怎么做 下面的是我的方法.
public static string GetHtmlData(string url)
{
string html = "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "Get";
request.ContentType = "application/x-www-form-urlencoded ";
WebResponse response = request.GetResponse();
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s, System.Text.Encoding.GetEncoding("GB2312"));
html = sr.ReadToEnd();
s.Close();
sr.Close();
return html;
}
<xml>
<row digit="2010112565" atime="21:58" anum="03 01 08 05 09" />
<row digit="2010112564" atime="21:46" anum="05 01 03 11 04" /> </xml>上面这一段是我从一个网页中读取出来的一个字符串,我现在想把他直接保存成xml该怎么做 下面的是我的方法.
public static string GetHtmlData(string url)
{
string html = "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "Get";
request.ContentType = "application/x-www-form-urlencoded ";
WebResponse response = request.GetResponse();
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s, System.Text.Encoding.GetEncoding("GB2312"));
html = sr.ReadToEnd();
s.Close();
sr.Close();
return html;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货