如何解析经典 asp 中的 reddit rss 提要?

How to parse a reddit rss feed in classic asp?

多年来我一直希望这个问题得到解答,但没有得到解答。我正在尝试使用经典 ASP 解析 Reddit RSS 提要,但我无法通过线程进行解析。我可以加载它,但到目前为止,解析它对我来说是不可能的。

我正在尝试解析任何 rss 提要,例如 https://www.reddit.com/r/worldnews.rss

我正在使用以下脚本:

rss_url ="https://www.reddit.com/r/worldnews.rss"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
    Err.Clear ' shouldn't be needed; can't hurt
    'ON ERROR RESUME NEXT
xml.open "GET", rss_url, False
xml.send
    'ON ERROR GOTO 0
    If Err.Number <> 0 Then
        Response.Write "NO feed from ..."
    Else
 ResponseXML = xml.responseText
 'response.write "<hr>"&ResponseXML&"<hr>"
Set doc = Server.CreateObject("Microsoft.DOMDocument")
doc.loadXML( xml.ResponseXML.xml )

Set items = doc.getElementsByTagName("entry")

For inum = 0 To items.length-1 
    Set curitem = items.entry(inum)
    title = Replace( curitem.SelectSingleNode("title").text, "'", "''" )
    content = Replace( curitem.SelectSingleNode("content").text, "'", "''" )
    Set linkNode = curitem.SelectSingleNode("link") 
    If linkNode Is Nothing Then 
        link = "**NONE**" ' if no description given, supply this 
    Else 
        link = Replace( linkNode.text, "'", "''" ) 
    End If 
    'link =  Replace( curitem.SelectSingleNode("link").text, "'", "''" ) 
    Set descNode = curitem.SelectSingleNode("description") 
    If descNode Is Nothing Then 
        description = "**NONE**" ' if no description given, supply this 
    Else 
        description = Replace( descNode.text, "'", "''" ) 
    End If
         response.write "<strong>"& title & "</strong><br>"& description &"<br>"& content &"<br>"& link &"<hr><br><br>"
Next

提要已加载,但我认为它没有加载到 dom。我不确定哪里出了问题。

rss_url ="https://www.reddit.com/r/worldnews.rss"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
    Err.Clear ' shouldn't be needed; can't hurt
    'ON ERROR RESUME NEXT
    xml.open "GET", rss_url, False
    xml.send
    'ON ERROR GOTO 0
    If Err.Number <> 0 Then
        Response.Write "NO feed from ..."
    Else
 ResponseXML = xml.responseText
 'response.write "<hr>"&ResponseXML&"<hr>"
 'response.end

Set doc = CreateObject("MSXML2.DOMDocument")
doc.loadXML( ResponseXML )

Set items = doc.getElementsByTagName("entry")

    For inum = 0 To items.length-1 
        Set curitem = items(inum)
        title = Replace( curitem.SelectSingleNode("title").text, "'", "''" )
        content = Replace( curitem.SelectSingleNode("content").text, "'", "''" )
        Set linkNode = curitem.SelectSingleNode("link") 
        If linkNode Is Nothing Then 
            link = "**NONE**" ' if no description given, supply this 
        Else 
            link = Replace( linkNode.text, "'", "''" ) 
        End If 
        'link =  Replace( curitem.SelectSingleNode("link").text, "'", "''" ) 
        Set descNode = curitem.SelectSingleNode("description") 
        If descNode Is Nothing Then 
            description = "**NONE**" ' if no description given, supply this 
        Else 
            description = Replace( descNode.text, "'", "''" ) 
        End If
             response.write "<strong>"& title & "</strong><br>"& description &"<br>"& content &"<br>"& link &"<hr><br><br>"
    Next
end if