httpWebResponse.GetResponseStream()忽略id =“ 0”

时间:2019-05-27 12:24:18

标签: c# json

我有一个XML,其中的节点如

<leaderboardStat ID="0" statName="xxxx">
<leaderboardStat ID="1" statName="yyyy">
<leaderboardStat ID="2" statName="uuuu">
<leaderboardStat ID="3" statName="iiiii">

我正在使用

httpWebRequest = HttpWebRequest.Create(url) as HttpWebRequest;
            httpWebRequest.Credentials = new NetworkCredential("xxxxxx", "xxxxxx");
            httpWebRequest.Method = "GET";
            httpWebRequest.ContentType = "application/xml";
            httpWebRequest.Accept = "text/json";
            httpWebRequest.Timeout = 420000;
            httpWebRequest.KeepAlive = false;
            httpWebRequest.ReadWriteTimeout = 420000;

using (HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse)
        {
            using (StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.Default))
            {
                content = streamReader.ReadToEnd();

                streamReader.Close();
            }
        }

问题是它不读取id =“ 0”,而是读取所有内容。任何想法出了什么问题。

0 个答案:

没有答案