EDN Admin
Well-known member
Im trying to get information about weather from google(in Xml).
But when I want to write response stream to XmlTextReader the result is always {none}
But when I write the response stream to string - it writes information
View the full article
But when I want to write response stream to XmlTextReader the result is always {none}
But when I write the response stream to string - it writes information
Code:
static void Main(string[] args)<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre XmlTextReader xmlreader;<br/>
<span style="white-space:pre HttpWebRequest req =<br/>
<span style="white-space:pre (HttpWebRequest)WebRequest.Create("http://www.google.com/ig/api?weather=" + "Minsk" + "&hl=" + "en");<br/>
<span style="white-space:pre HttpWebResponse resp = (HttpWebResponse)req.GetResponse();<br/>
<span style="white-space:pre StringBuilder sb = new StringBuilder();<br/>
<span style="white-space:pre using (StreamReader streamreader = new StreamReader(resp.GetResponseStream(), Encoding.GetEncoding(1251)))<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre //sb.AppendLine(streamreader.ReadToEnd());<br/>
<span style="white-space:pre xmlreader = new XmlTextReader(streamreader);<br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre }
View the full article