Incorporate blog roll

Let’s say you have a WordPress blog at another domain and you want to show it on another domain.

Well, you’re better off using a more standard way of incorporating a WordPress blog into your website (just google around), but if you need to do something more custom, here’s a possibility.

Here’s some pseudo code for a .Net application – you get the idea.  One thing to keep in mind is that XMLDocument is not serializable, so if you want to save it in a session state or do something else, you will need to work around it.

            Dim xmlReader As XmlReader = xmlReader.Create("your website blog url goes here/feed/rss")
            Dim xmlDocument As XmlDocument = New XmlDocument
            xmlDocument.Load(xmlReader)
            Dim xmlNameSpaceManager As XmlNamespaceManager = New XmlNamespaceManager(xmlDocument.NameTable)
            xmlNameSpaceManager.AddNamespace("content", "http://purl.org/rss/1.0/modules/content/")
            xmlNameSpaceManager.AddNamespace("wfw", "http://wellformedweb.org/CommentAPI/")
            xmlNameSpaceManager.AddNamespace("dc", "http://purl.org/dc/elements/1.1/")
            xmlNameSpaceManager.AddNamespace("atom", "http://www.w3.org/2005/Atom")
            xmlNameSpaceManager.AddNamespace("sy", "http://purl.org/rss/1.0/modules/syndication/")
            xmlNameSpaceManager.AddNamespace("slash", "http://purl.org/rss/1.0/modules/slash/")
            Dim items As XmlNodeList = xmlDocument.SelectNodes("/rss/channel/item")
            For Each item As XmlNode In items
                Dim bloglink As String = item("link").InnerText
                Dim blogTitle As String = item("title").InnerText
                Dim pubDate As String = item("pubDate").InnerText
                Dim blogAuthor As String = item("dc:creator").InnerText
            Next
Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: