I have some very simple code used to scrape a particular website and parse the HTML that was using a version of SgmlReader prior to the Nuget package's existence. The DLL I was using reports the version as 1.8.7.0. If I continue to use this version there are no problems with my code. However, if I switch to using the Nuget version (the DLL reports the version as 1.8.8.0) the code fails with a WebException ("The operation has timed out"). Here's basically what the code looks like:
The exception is thrown from the "return XDocument.Load(sgmlReader);" statement. Any ideas what the problem is here and how to correct it?Code:using (var client = new WebClient() { Encoding = Encoding.UTF8 }) { var sgml = client.DownloadString(address); using (var stringReader = new StringReader(sgml)) { using (var sgmlReader = new SgmlReader()) { sgmlReader.DocType = "HTML"; sgmlReader.WitespaceHandling = WhitespaceHandling.All; sgmlReader.CaseFolding = CaseFolding.ToLower; sgmlReader.InputStream = stringReader; return XDocument.Load(sgmlReader); } } }


Reply With Quote
. "return XDocument.Load(sgmlReader)" is throwing a WebException with a message that reads "The operation has timed out".

