Coding For a Living


A place to share and comment about coding for a living.

VB RSS Feed Aggregator Mike McIntyre

A RSS feed aggregator aggregates syndicated web content such as online newspapers, blogs, podcasts, and video blogs (vlogs) for various purposes e.g. to provide one location for easy viewing.

The VB module provides a code sample for one way you can create a RSS feed aggregator with VisualBasic.

Module Module1
    Const feedUrl As String = "http://+:8086/VBfeeds/"

    Sub Main()
        Dim listener As New HttpListener


        'Open a browser pointing at the feeds being served.
        System.Diagnostics.Process.Start("iexplore.exe", "http://localhost:8086/VBfeeds/")

        'Serve requests.
        While True
            Dim context As HttpListenerContext = listener.GetContext()
            Dim body As XElement = GetReplyBody()
            context.Response.ContentType = "text/xml"

            Using writer As XmlWriter = New XmlTextWriter(context.Response.OutputStream, System.Text.Encoding.UTF8)
            End Using
        End While

    End Sub

    Function GetReplyBody() As XElement
        Dim feeds() As String = {"
                                 "", _

                       VB Genius
                       VB Team Members
                       XLinq-based RSS aggregator using VB Only Super Cool XML Literals Feature
    End Function
End Module