J
jeff3048
Hi,
I am writing a c# .net Visual Studio 2005 console application that retrieves
RSS feed xml from various web sources (urls). I have been told that an
exception thrown in a console application terminates its scheduled operation
so I have to be careful in my code to trap any errors. It is conceivable to
me that while downloading an xml document from a url that there may be
trouble at the other end causing an excessive delay in file download. I want
to be able to set a timeout on the file download so that my routine can skip
the current xml document if the timeout is exceeded and proceed to the next
url/xml. I am very new to xml stuff and don’t really know where to begin to
implement a timeout on the XmlDocument Load object. Can anyone provide some
guidance? My search on the web touched some reference to using "XmlResolver,
where you can set timeout on httpwebrequest" but no implementation. Any help
will be appreciated.
Thank you,
Jeff
My Pseudo code
int j = 0;
foreach (strFeedURL in my list of urls)
{
//Example: strFeedURL =
@"http://hosted.ap.org/lineups/POLITICSHEADS-rss_2.0.xml?SITE=PASTR&SECTION=HOME";
XmlDocument xDoc = new XmlDocument();
xDoc.Load(strFeedURL);
XmlPutFilePathName = c:\rssxml\rssfeed" + Convert.ToString(j) + ".xml";
xDoc.Save(XmlPutFilePathName);
j++;
}
I am writing a c# .net Visual Studio 2005 console application that retrieves
RSS feed xml from various web sources (urls). I have been told that an
exception thrown in a console application terminates its scheduled operation
so I have to be careful in my code to trap any errors. It is conceivable to
me that while downloading an xml document from a url that there may be
trouble at the other end causing an excessive delay in file download. I want
to be able to set a timeout on the file download so that my routine can skip
the current xml document if the timeout is exceeded and proceed to the next
url/xml. I am very new to xml stuff and don’t really know where to begin to
implement a timeout on the XmlDocument Load object. Can anyone provide some
guidance? My search on the web touched some reference to using "XmlResolver,
where you can set timeout on httpwebrequest" but no implementation. Any help
will be appreciated.
Thank you,
Jeff
My Pseudo code
int j = 0;
foreach (strFeedURL in my list of urls)
{
//Example: strFeedURL =
@"http://hosted.ap.org/lineups/POLITICSHEADS-rss_2.0.xml?SITE=PASTR&SECTION=HOME";
XmlDocument xDoc = new XmlDocument();
xDoc.Load(strFeedURL);
XmlPutFilePathName = c:\rssxml\rssfeed" + Convert.ToString(j) + ".xml";
xDoc.Save(XmlPutFilePathName);
j++;
}