Do html parser need some time to parse?

Topics: Developer Forum, User Forum
Nov 2, 2011 at 12:42 PM
Edited Nov 2, 2011 at 12:42 PM

Hi there,

I use html parser loading an HttpWebResponse's stream, this way:

doc.Load(response.GetStream())

problem is that in my program I have to make multiple http requests and, for each response, parse it and extract some fields of interest...I experienced that, if I put get page/parse/extraction code in a for loop some exception rise on! For example I got some null tag elements, and so on!

I check every link and page and I'm 100% sure it's not a code/xpath syntax problem, moreover these exceptions are absolutely random: same page can generate them or not!

So I ask: do I have to wait for some time after doc.Load? Or do I have to close the document at the end?(I can't see any Close() method, though...)