We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

RSS feed in C# - get exchange rates

Medium Priority
733 Views
Last Modified: 2013-11-18
How do I get the exchange rate from this rss feed? http://www.rba.gov.au/rss/rss-cb-exchange-rates.xml

Void GetExchangeRate (string CurrencyCode, out Decimal ReturnRate, out DateTime ReturnDateTime)
{

//Do something...

//Return the Rate and DateTime


}
Comment
Watch Question

Commented:

<MARQUEE  id="ml"  runat="server"  style="PADDING-TOP: 2px" onmouseover=" this.stop()" onmouseout=this.start() direction=right height=24 width="100%" scrollAmount=4><SPAN class=sep>¿¿¿¿¿¿¿.¿¿</SPAN></MARQUEE>
 
 
Public Partial Class arabiaNews
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        newsarabia()
    End Sub
 
    Sub newsarabia()
        Dim ds As New Data.DataSet
        Dim strRss As String = Server.MapPath("Intranet/arabiaRss.xml")
        ds.ReadXml(strRss)
        If ds.Tables.Count > 0 Then
            If ds.Tables(3).Rows.Count > 0 Then
                For i As Integer = 0 To ds.Tables(3).Rows.Count - 1
                    Dim NewTitle As String = ds.Tables(3).Rows(i)("title")
                    Dim url As String = ds.Tables(3).Rows(i)("link")
                    Dim lnk As New HtmlAnchor 'With {.InnerHtml = NewTitle, .HRef = url, .Target = "_blank"}
                    lnk.InnerHtml = NewTitle
                    lnk.HRef = url
                    lnk.Target = "_blank"
                    ml.Controls.Add(lnk)
                    ml.Controls.Add(New LiteralControl("&nbsp;&nbsp;&nbsp;"))
                Next
            End If
        End If
    End Sub
End Class

Open in new window

You could go the route of loading the response into an XDocument or XmlReader and parsing out what you need manually. Bu a better approach would be to use an RSS parser meant for the job.

This is a good example of how to parse RSS feeds, you should be able to extract the required values easily using this: http://www.shrinkrays.net/code-snippets/csharp/simplified-csharp-atom-and-rss-feed-parser.aspx. There are also links to other feebie RSS parsers if this simple one does not cater for your needs.
Project Manager
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.