jrthor2
10-07-2004, 01:07 PM
I am trying to create a valid rss 2.0 file to syndicate an area of my website. Below is the code I am using. I am not getting any results.
<?xml version="1.0"?>
<% Response.Buffer = true
'Response.ContentType = "text/xml"
Function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
ApplyXMLFormatting = strInput
End Function
%>
<rss version="2.0">
<channel>
<title>xxx</title>
<link>http://www.xxx.org</link>
<description>List of the xxx</description>
<language>en-us</language>
<copyright></copyright>
<lastBuildDate><%=Now()%></lastBuildDate>
<ttl>20</ttl>
<%
Dim conn
db = "/db/hso.mdb"
today = Month(Date) & "/" & Day(Date) & "/" & Year(Date)
Set conn = server.createobject("adodb.connection")
DSNtemp="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(db)
conn.Open DSNtemp
Dim objRS, strSQL, strDesc
strSQL = "SELECT id, rehearsal_dte, rehearsal_place, rehearsal_time from Rehearsals where"
strSQL = strSQL & ("rehearsal_dte >= #" & today & "#")
strSQL = strSQL & ("order by rehearsal_dte asc, rehearsal_time asc")
Set objRS = conn.Execute(strSQL)
Do While Not objRS.EOF
strDesc = "<b>Date:</b> " & objRS("REHEARSAL_DTE").Value & "<b>Place:</b> " & _
objRS("REHEARSAL_PLACE").Value
%>
<item>
<title>xxx</title>
<link>http://www.xxx.org</link>
<description><%=ApplyXMLFormatting(strDesc)%></description>
</item>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</channel>
</rss>
I get a blank page and here is the view source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
<?xml version="1.0"?>
<% Response.Buffer = true
'Response.ContentType = "text/xml"
Function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
ApplyXMLFormatting = strInput
End Function
%>
<rss version="2.0">
<channel>
<title>xxx</title>
<link>http://www.xxx.org</link>
<description>List of the xxx</description>
<language>en-us</language>
<copyright></copyright>
<lastBuildDate><%=Now()%></lastBuildDate>
<ttl>20</ttl>
<%
Dim conn
db = "/db/hso.mdb"
today = Month(Date) & "/" & Day(Date) & "/" & Year(Date)
Set conn = server.createobject("adodb.connection")
DSNtemp="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(db)
conn.Open DSNtemp
Dim objRS, strSQL, strDesc
strSQL = "SELECT id, rehearsal_dte, rehearsal_place, rehearsal_time from Rehearsals where"
strSQL = strSQL & ("rehearsal_dte >= #" & today & "#")
strSQL = strSQL & ("order by rehearsal_dte asc, rehearsal_time asc")
Set objRS = conn.Execute(strSQL)
Do While Not objRS.EOF
strDesc = "<b>Date:</b> " & objRS("REHEARSAL_DTE").Value & "<b>Place:</b> " & _
objRS("REHEARSAL_PLACE").Value
%>
<item>
<title>xxx</title>
<link>http://www.xxx.org</link>
<description><%=ApplyXMLFormatting(strDesc)%></description>
</item>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</channel>
</rss>
I get a blank page and here is the view source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>