I hit a snag a few days ago while doing some Xml parsing in one of my applications.
I am using XDocument for Xml parsing(XLinq is beautiful (K)).
Doing XDocument.Load(urlString) or XmlTextReader(
Code Snippet (fails):
WebRequest req = WebRequest.Create("
WebResponse res = req.GetResponse();
XmlTextReader reader = new XmlTextReader(res.GetResponseStream());
XDocument xdoc = XDocument.Load(reader, LoadOptions.SetLineInfo); //LoadOptions.SetLineInfo helps with debugging.
Code Snippet (works):
WebRequest req = WebRequest.Create("
WebResponse res = req.GetResponse();
StreamReader reader = new StreamReader(res.GetResponseStream());
XDocument xdoc = XDocument.Load(reader, LoadOptions.SetLineInfo); //LoadOptions.SetLineInfo helps with debugging.
Happy XLinq-ing.