Jump to content

Asp.net Xml Feed Error


kwilliams

Recommended Posts

I have an ASP.NET page that parses an external XML feed (please see example code below). It works...but when the feed goes down, it subsequently brings my site down. So I've created a default XML document that's located on my internal server a backup method when/if the external feed goes down. But I have no idea how to do this. If someone could let me know how to accomplish this, or point me in the right direction, that would be great. Thanks in advance.ASP.NET XML FEED CODE

Dim intSWACounter As Integer = 0		Dim swa_xmld As New XmlDocument() 'Create the XML Document		Dim swa_nodelist As XmlNodeList		Dim swa_node As XmlNode		Dim objShowWeatherAlert As Object = False				'Check for active severe weather alerts		Try			'Load the Xml file			swa_xmld.Load("http://www.weather.gov/alerts-beta/wwaatmget.php?x=COC035") 'LIVE: Example feed		Catch			'What to do when it encounters an error			swa_xmld.Load(MapPath("/mysite/docs/xml/weatheralert_down.xml")) 'DOWN		Finally			'Include code to run, no matter whether the code throws an exception or whether it runs successfully			'Get the list of name nodes			Dim xnm As New XmlNamespaceManager(swa_xmld.NameTable)			xnm.AddNamespace("atom", "http://www.w3.org/2005/Atom")			swa_nodelist = swa_xmld.SelectNodes("/rss/channel/item[title != 'There are no active watches, warnings or advisories in Colorado (Douglas/COC035)']", xnm) 'LIVE		End Try

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...