播客rss在经典的asp中读取itunes图像

时间:2021-07-15 05:23:01

I'm working on a rss feed reader and seems so work great. The only thing that I seem not to get working is to read the image in the feed.

我正在使用rss feed阅读器,看起来非常棒。我似乎唯一没有工作的是阅读Feed中的图像。

<itunes:image href="http://www.itunes.com/image.jpg"/>

Can anyone help?

有人可以帮忙吗?

This is a part of my code.

这是我的代码的一部分。

  For Each objItem in objItems
      On Error Resume Next
      TheTitle =  objItem.selectSingleNode("title").Text
      TheLink =  objItem.selectSingleNode("image").Text
      Theimg =  objItem.SelectSingleNode("itunes").Attributes(":image").InnerText

      Response.Write "<div class='article'>" &_
                     "<a href=" & TheLink & ">" & _
                     "<span>" & Theimg & TheTitle & "</span>" & _
                     "</a>" & _
                     "</div>"
 Next

1 个解决方案

#1


Your image address needs to go inside an image tag

您的图片地址需要进入图片代码

Response.Write "<div class=""article"">" &_
                 "<a href=""" & TheLink & """>" & _
                 "<img src=""" & Theimg & """ alt=""" & TheTitle & """ />"  & _
                 "</a>" & _
                 "</div>"

If you're wondering why all the double quotes, see this question

如果你想知道为什么所有的双引号,请看这个问题

Adding quotes to a string in VBScript

在VBScript中为字符串添加引号

As an aside, if you understand XSL then I find that the best way to handle RSS feeds in Classic ASP is to do a server side XSLT transformation. The ASP looks like this

顺便说一句,如果您了解XSL,那么我发现在Classic ASP中处理RSS提要的最佳方法是进行服务器端XSLT转换。 ASP看起来像这样

set xml = Server.CreateObject("Msxml2.DomDocument.6.0")
xml.setProperty "ServerHTTPRequest", true
xml.async = false
xml.validateOnParse = false
xml.load("http://your-rss-feed")
set xsl = Server.CreateObject("Msxml2.DomDocument.6.0")
xsl.load(Server.Mappath("yourxslfile.xsl"))
Response.Write(xml.transformNode(xsl))
set xsl = nothing
set xml = nothing

#1


Your image address needs to go inside an image tag

您的图片地址需要进入图片代码

Response.Write "<div class=""article"">" &_
                 "<a href=""" & TheLink & """>" & _
                 "<img src=""" & Theimg & """ alt=""" & TheTitle & """ />"  & _
                 "</a>" & _
                 "</div>"

If you're wondering why all the double quotes, see this question

如果你想知道为什么所有的双引号,请看这个问题

Adding quotes to a string in VBScript

在VBScript中为字符串添加引号

As an aside, if you understand XSL then I find that the best way to handle RSS feeds in Classic ASP is to do a server side XSLT transformation. The ASP looks like this

顺便说一句,如果您了解XSL,那么我发现在Classic ASP中处理RSS提要的最佳方法是进行服务器端XSLT转换。 ASP看起来像这样

set xml = Server.CreateObject("Msxml2.DomDocument.6.0")
xml.setProperty "ServerHTTPRequest", true
xml.async = false
xml.validateOnParse = false
xml.load("http://your-rss-feed")
set xsl = Server.CreateObject("Msxml2.DomDocument.6.0")
xsl.load(Server.Mappath("yourxslfile.xsl"))
Response.Write(xml.transformNode(xsl))
set xsl = nothing
set xml = nothing