Jump to content

Asp.net Xml Feed Error

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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...