Trying to parse a RSS feed with XPATH using ASP

Discussion in 'XML & RSS' started by biedrzycki, Dec 18, 2006.

  1. #1
    Hi all I am very new to RSS. I have developed websites with Amazon.com's and eBay's web services. My sites run Active Server Pages and I parse the XML from the web service with Msxml2.DOMDocument.3.0 and XPath. I was interested in getting a news feed from Google about Blu-ray. I went there and I was able to get the news feed I wanted by formulating a search of google news like this: http://news.google.com/news?q=blu-ray&output=rss.
    This returns XML to the browser, just like I get from the web services. I tried parsing this with my script , but nothing displays. Like I said I've never used an RSS feed before, so I don't really know what I'm doing, I'm just experimenting. Can I parse a RSS feed like this? Here's the ASP code I was trying

    <%
    URLToRSS = "http://news.google.com/news?q=blu-ray&output=rss"

    ' Create XMLHTTP object - to be used for sending request
    Dim oHTTP
    Set oHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
    ' Send synchronous call to Web Services
    oHTTP.Open "GET", URLToRSS, False
    oHTTP.Send()
    RSSXML = oHTTP.ResponseText
    ' Create DOMDocument object - to be used for loading XML response
    Dim oXML
    Set oXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
    ' Load XML, and set XPATH as selection language
    oXml.async = False
    oXml.LoadXml(RSSXML)
    oXml.setProperty "SelectionLanguage", "XPath"

    Dim items
    Set items = oXML.selectNodes("//channel/item")

    Dim item
    For Each item In items

    Dim title
    Set title = item.selectSingleNode("title")

    Dim link
    Set link = item.selectSingleNode("link")
    %>

    Title : <%=title.text%> <br>
    Link : <%=link.text%> <p>

    <%
    Next
    %>

    This does not produce any errors but Nothing shows up. Can anyone point me in the right direction? Thanks

    If you want to see the XML I am trying to parse just paste this in your browser
    http://news.google.com/news?q=blu-ray&output=rss
     
    biedrzycki, Dec 18, 2006 IP