SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot blackinwhite's Avatar
    Join Date
    Feb 2001
    Location
    Istanbul/Turkey
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    creating rss file with asp

    I have coded this.
    Code:
    <%
    ' -----------------
    ' RSS FILE
    ' -----------------
    'response.ContentType = "text/xml"
    
    set conn = Server.CreateObject("ADODB.Connection") 
    
    ' 
    strDatabasePath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=xxx;" 
    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabasePath & ";"
    
    sql="select fldMessageID, fldMessageHeader, fldMessageTitle from tblMessages"
    
    set rs=Conn.Execute(sql)
    rs.MoveFirst()
    
    '----------------
    ' HEADER
    '----------------
    response.write("<?xml version=""1.0""?>")
    response.write("<rss version=""0.91"">")
    ' ---------------
    
    response.write("<channel>")
    
    
    response.write("<title>title</title>")
    response.write("<link>link</link>")
    response.write("<description>description</description>")
    response.write("<language>en-us</language>")
    
    ' -----------------------
    while (not rs.EOF)
      response.write("<item>")
      response.write("<title>" & rs("fldMessageTitle") & "</title>") & vbcrlf & vbcrlf
      response.write("<description>") & vbcrlf
    
      response.write ("<![CDATA[") & vbcrlf
      
      response.write("<p>" & rs("fldMessageHeader") & "</p>") & vbcrlf
      response.write("]]>") & vbcrlf
      response.write("</description>") & vbcrlf
      response.write("<link>http://www.site/messages.asp?message=" & rs("fldMessageId") & "</link>") & vbcrlf & vbcrlf
      response.write("</item>")
      rs.MoveNext()
    wend
    ' ------------------------
    
    
    rs.close() 'clear
    conn.close() ' clear
    
    response.write("</channel>")
    
    response.write("</rss>")
    %>
    but it doesn't work as a rss file.

    do you see any erro, or missing part in that.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Maybe you should un-comment your "response.contenttype" line?

    --Vinnie

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest that you validate the RSS you are generating - see here for one way to do this:
    http://www.ldodds.com/rss_validator/

    Or simply validate it using this DTD:
    http://my.netscape.com/publish/formats/rss-0.91.dtd
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •