473,322 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Create Rss feed from data in database

I would like to create a RSS feed from my Access Database.
I have an Access table for news which has the article title, date, and
story in it. What I would like to do is pull the data from there into an
xml file to create the RSS feed, so when users upload a news story it
automatically updates in the xml file. Can this be done with asp? and where
should I look for more information. Thanks, This is a great group.

--
Posted via a free Usenet account from http://www.teranews.com

Apr 25 '07 #1
4 12953
<?xml version="1.0" encoding="ISO-8859-1"?>
<% Response.Buffer = true
Response.ContentType = "text/xml"

Function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&amp;")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", "&quot;")
strInput = Replace(strInput, ">", "&gt;")
strInput = Replace(strInput,"<","&lt;")

ApplyXMLFormatting = strInput
End Function
%>
<rss version="2.0">
<channel>
<title>xxxxxxxxxxxx</title>
<description>xxxxxxxxxxxxx</description>
<link>xxxxxxxxxxxxx</link>
<language>en-us</language>
<copyright>xxxxxxxxxxx</copyright>
<managingEditor>xxxxxxxxxxxx</managingEditor>

<%
Dim rs_blog_feed
Dim rs_blog_feed_numRows

Set rs_blog_feed = Server.CreateObject("ADODB.Recordset")
rs_blog_feed.ActiveConnection = xxxxxxxx
rs_blog_feed.Source = "xxxxxxxxxxxxxxxx"
rs_blog_feed.CursorType = 0
rs_blog_feed.CursorLocation = 2
rs_blog_feed.LockType = 1
rs_blog_feed.Open()

rs_blog_feed_numRows = 0
%>

<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
rs_blog_feed_numRows = rs_blog_feed_numRows + Repeat1__numRows
%>

<%
While ((Repeat1__numRows <0) AND (NOT rs_blog_feed.EOF))
%>
<item>
<title>xxxxxxxxxxx</title>
<description><%=ApplyXMLFormatting(xxxxxxxxxxxxxx) %></description>
<link>xxxxxxxxxxxxxxxxx</link>
<pubDate>xxxxxxxxxxxxxx</pubDate>
</item>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rs_blog_feed.MoveNext()
Wend
%>

<%
rs_blog_feed.Close()
Set rs_blog_feed = Nothing
%>
</channel>
</rss>




On Apr 25, 12:10 pm, Billy Barth <bj.ba...@gmail.comwrote:
I would like to create a RSS feed from my Access Database.
I have an Access table for news which has the article title, date, and
story in it. What I would like to do is pull the data from there into an
xml file to create the RSS feed, so when users upload a news story it
automatically updates in the xml file. Can this be done with asp? and where
should I look for more information. Thanks, This is a great group.

--
Posted via a free Usenet account fromhttp://www.teranews.com

Apr 26 '07 #2

"Billy Barth" <bj******@gmail.comwrote in message
news:Xn*****************************@66.150.105.47 ...
>I would like to create a RSS feed from my Access Database.
I have an Access table for news which has the article title, date, and
story in it. What I would like to do is pull the data from there into an
xml file to create the RSS feed, so when users upload a news story it
automatically updates in the xml file. Can this be done with asp? and
where
should I look for more information. Thanks, This is a great group.
Was used to pull all stories entered within the last 30 days. Obviously you
can alter the date range, regional settings (eg language, date format, time)
and links according to your needs. The result validates against RSS 2.0.

<%
function tidyxml(text)
text = replace(text,Chr(180),"'")
text = replace(text,"&","&amp;")
text = replace(text,"'","'")
text = replace(text,"'","'")
text = replace(text,""","""")
text = replace(text,""","""")
text = replace(text,"<br>","")
text = replace(text,"-","-")
text = replace(text,"<","<")
text = replace(text,">",">")
tidyxml = text
End function

thedate = Month(CurrDate) & "/" & Day(CurrDate) & "/" & Year(CurrDate)
if Month(CurrDate) = 1 then
thepreviousdate = "12/" & Day(CurrDate) & "/" & (Year(CurrDate)-1)
else
thepreviousdate = (Month(CurrDate)-1) & "/" & Day(CurrDate) & "/" &
Year(CurrDate)
end if

newsSQL = "SELECT StoryID,Headline, Description, DateEntered FROM Stories "
& _
WHERE DateEntered BETWEEN " & _
"#" & thedate & " 23:59:59# And #" & thepreviousdate & " 0:0:1#;"
set conn = server.createobject("ADODB.Connection")
conn.Open connectionstring
set rsNews = conn.execute(newsSQL)

If Not rs.EOF Then

arrNews = rsNews.GetRows()
rsNews.close : set rsNews = nothing
conn.close : set conn = nothing

filename = "rss/rss.xml"
set fso = createobject("scripting.filesystemobject")
set xmlfile = fso.createtextfile(server.mappath(filename),true)

xmlfile.writeline("<?xml version=""1.0"" encoding=""iso-8859-1""?>")
xmlfile.writeline("<rss version=""2.0"">")
xmlfile.writeline("<channel>")
xmlfile.writeline("<title>Title</title>")
xmlfile.writeline("<link>Url</link>")
xmlfile.writeline("<description>Description</description>")
xmlfile.writeline("<language>en-gb</language>")

CurrDate = Now()
CurrHour = Hour(CurrDate)
if CurrHour < 10 then CurrHour = "0" & CurrHour
CurrMin = Minute(CurrDate)
if CurrMin < 10 then CurrMin = "0" & CurrMin
CurrSec = Second(CurrDate)
if CurrSec < 10 then CurrSec = "0" & CurrSec
CurrDateT = WeekdayName(Weekday(CurrDate), TRUE) & ", " & Day(CurrDate) & "
" & _
MonthName(Month(CurrDate), TRUE) & " " & Year(CurrDate) & " " & _
CurrHour & ":" & CurrMin & ":" & CurrSec & " GMT"

xmlfile.writeline("<lastBuildDate>" & CurrDateT & "</lastBuildDate>")
xmlfile.writeline("<copyright>Copyright: (C) " & Year(Now()) & "
CopyrightOwner</copyright>")

for i = 0 to ubound(arrNews,2)
PubDate = arrNews(3,i)
PubHour = Hour(PubDate)
if PubHour < 10 then PubHour = "0" & PubHour
PubMin = Minute(PubDate)
if PubMin < 10 then PubMin = "0" & PubMin
PubSec = Second(PubDate)
if PubSec < 10 then PubSec = "0" & PubSec

PubDateT = WeekdayName(Weekday(PubDate), TRUE) & ", " & Day(PubDate) & " " &
_
MonthName(Month(PubDate), TRUE) & " " & Year(PubDate) & " " & _
PubHour & ":" & PubMin & ":" & PubSec & " GMT"

xmlfile.writeline("<item>")
xmlfile.writeline("<title>" & tidyxml(arrNews(1,i)) & "</title>")
xmlfile.writeline("<description>" & tidyxml(arrNews(2,i)) &
"</description>")
xmlfile.writeline("<link>URL/story.asp?id=" & arrNews(0,i) & "</link>")
xmlfile.writeline("<guid isPermaLink=""false"">URL/story.asp?id=" &
arrNews(0,i) & "</guid>")
xmlfile.writeline("<pubDate>" & PubDateT & "</pubDate>")
xmlfile.writeline("</item>")
next
xmlfile.writeline("</channel>")
xmlfile.writeline("</rss>")
set fso = nothing

Else
rs.close
End If
%>
Apr 26 '07 #3
"Mike Brind" <du***@newsgroups.comwrote in
news:u8**************@TK2MSFTNGP02.phx.gbl:
>
"Billy Barth" <bj******@gmail.comwrote in message
news:Xn*****************************@66.150.105.47 ...
>>I would like to create a RSS feed from my Access Database.
I have an Access table for news which has the article title, date,
and story in it. What I would like to do is pull the data from there
into an xml file to create the RSS feed, so when users upload a news
story it automatically updates in the xml file. Can this be done with
asp? and where
should I look for more information. Thanks, This is a great group.

Was used to pull all stories entered within the last 30 days.
Obviously you can alter the date range, regional settings (eg
language, date format, time) and links according to your needs. The
result validates against RSS 2.0.

<%
function tidyxml(text)
text = replace(text,Chr(180),"'")
text = replace(text,"&","&amp;")
text = replace(text,"'","'")
text = replace(text,"'","'")
text = replace(text,""","""")
text = replace(text,""","""")
>
Thanks!

--
Posted via a free Usenet account from http://www.teranews.com

Apr 30 '07 #4
ave
On Apr 25, 6:10 pm, Billy Barth <bj.ba...@gmail.comwrote:
I would like to create a RSS feed from my Access Database.
I have an Access table for news which has the article title, date, and
story in it. What I would like to do is pull the data from there into an
xml file to create the RSS feed, so when users upload a news story it
automatically updates in the xml file. Can this be done with asp? and where
should I look for more information. Thanks, This is a great group.
I have created a class in ASP that enables you to easily create Atom
feeds:

http://www.codercow.com/AtomXML/

It is not a complete implementation of the Atom standard, since I
doubt most people find it relevant to include ie. 2 different sizes of
images etc. But it is easy to extend to suit your needs.

Most people just use it out of the box.

Others have posted the necessary code to retrieve and run through a
recordset, all you have to do is call the method AddEntry for each
record.

Best regards,

Anders Vind Ebbesen

May 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
3
by: adi | last post by:
Hi all, My program is a central data processing application built in ASP. We have different companies that use different web pages on another web application (from different countries) to load...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
11
by: caine | last post by:
I'm currently working on creating the xml feed since I had data ready in my database after web data extraction. However, it has errors for this line: <xml version="1.0" encoding="ISO-8859-1"> ...
6
by: Savante | last post by:
I have been writing a datalogging application. It reads in double's into a database. I want to be able to click on a row in a database (holds name of variable and also current value of variable)...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
7
by: chromis | last post by:
Hi, I've created a utf8 encoded RSS feed which presents news data drawn from a database. I've set all aspects of my database to utf8 and also saved the text which i have put into the database as...
2
jamwil
by: jamwil | last post by:
What's up guys. I'm having some issues... I've created a method as part of my lifestreaming class which takes an rss feed, and puts the data into a database... It's fairly simple... Check...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.