• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1220
  • Last Modified:

Convert a Classic ASP RecordSet into a valid RSS Feed

Hi,
I'm currently using classic ASP page to display daily travel specials on our website. They want me to create a RSS feed so users interested can monitor them through their preferred reader.

I would like to pull records dynamically from the db and create a rss feed.
How would I best approach this?

Our specials page pulls from SQLdb.
dbo.TravelSpecials with fields labeled ID, TITLE, DESCRIPTION & PRICE.

I've been playing around with this but it only creates an unformatted xml file.

<?xml version="1.0" encoding="iso-8859-1"?>
<% Response.ContentType="application/xml" %>

<Travel version="1" xmlns="http://xspf.org/ns/0/">
<specialList>
<%
dim MM_conn_STRING

Dim rsSpecials__MMColParam
rsSpecials__MMColParam = "1"
if (Request.QueryString("ID") <> "") then rsSpecials__MMColParam = Request.QueryString("ID")
set MM_conn_STRING = Server.createobject("ADODB.connection")
MM_conn_STRING.open "Provider=SQLOLEDB;Password=XXXXXX;Persist Security Info=True;User ID=XXXXXX;Initial Catalog=XXXXXX;Data Source=sql2005-X.XXXX.com"


sqlString = "SELECT * FROM TravelSpecials"
SET RSNews = MM_conn_STRING.Execute( sqlString )
DO Until (RSNews.EOF)

response.write "<Specials>"
response.write "<title>" + rsNews("Title") + "</title>"
response.write "<Description>" + rsNews("Description") + "</aDescription>"
response.write "<Price>" + rsNews("Title") + "</Price>"
response.write "</Specials>"
 

RSNews.MoveNext
Loop
rsNews.close
Set rsNews = nothing
%>
</specialList>
</Travel>
0
swaggerking
Asked:
swaggerking
  • 10
  • 5
1 Solution
 
Wayne BarronCommented:
I am getting the same results as you.
I am still working on it.....

Very strange, never had this issue before???
0
 
swaggerkingAuthor Commented:
Hey carrziss,
Two things I noticed in my initial question:

1) Typo:
response.write "<Description>" + rsNews("Description") + "</aDescription>"
It should be
response.write "<Description>" + rsNews("Description") + "</Description>"

2) Not sure if this matters for the line that reads:
<Travel version="1" xmlns="http://xspf.org/ns/0/">
I took this original code from a mp3 shareable playlist I did.

Could any of these be causing the problem?
0
 
Wayne BarronCommented:
I have taken my Sitemap code and another XML Generated code and I cannot for the life of me
Get it to work either way.
This is so very strange.
All my other XML Feeds work great that I have done, I have tested them all.
But, this one if causing some major issue.
And I am not even using the same code as you posted, I am using my own.
I just created a database with the fields that you have provided, and it is a informatted mess....

Still working on it.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Wayne BarronCommented:
I am going to loose my mind here.
I cannot create NO new asp -to- xml documents.
I can load existing ones, but when I try to create a new one, the system displays it as plain text.

Basically, there is no <TAGS></TAGS>

I am going to reboot my computer and see if that will fix the issue.
I suggest that you try to reboot as well, and Maybe...?
After the reboot it will work.

I have never experianced this before, so, I am going to try the reboot and see what happens.

Carrzkiss
0
 
Wayne BarronCommented:
Works on my other computer, but not on my developer computer.

Hope this works for you on yours.

Carrzkiss
<% Response.ContentType="application/xml" %><?xml version="1.0" encoding="ISO-8859-1"?><%
Set cnMenu = Server.CreateObject("ADODB.Connection")
cnMenu.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("Q_24370143.mdb") & ";"
cnMenu.Open
JSID = request.QueryString("JSID")
sqlMenu = "SELECT ID, Title, Description, Price FROM TravelSpecials"
Set rsNews = Server.CreateObject("ADODB.Recordset")
rsNews.Open sqlMenu, cnMenu
%><Travel><specialList>
<%DO Until (rsNews.EOF)%>
<Specials>
<title><%=rsNews("Title")%></title>
<Description><%=rsNews("Description")%></Description>
<Price><%=rsNews("Title")%></Price>
</Specials><%
rsNews.MoveNext
Loop
rsNews.close
Set rsNews = nothing
%></specialList>
</Travel>

Open in new window

0
 
Wayne BarronCommented:
Rebooting my computer fixed the issue with not being able to display newly created ASP/XML
Files.

Working example
http://ee.cffcs.com/Q_24370143/Q_24370143.asp
Code
http://ee.cffcs.com/Q_24370143/Q_24370143.zip

Have a good one.
Carrzkiss

p.s.
To anyone that may have a problem viewing newly created XML files with .asp extension.
Reboot your computer, as the XML Parser is broken in the asp pages.
This is only if new files do not display.
And old files display correctly. (With .asp extension).
0
 
swaggerkingAuthor Commented:
Big thanks carrzkiss!

Forgive my dumb question.  Since there is no styles associated with it it comes back as:
Test 1 This is test 1 Test 1 Test 2 This is test 2 Test 2 ..." or document tree dependent on what browser I'm using.

Would I only need to apply a style sheet? I was hoping to find out how implement this xml file into a rss feed. Kind of like how cnn.com does it for their top stories:
http://rss.cnn.com/rss/cnn_topstories.rss

I'm still very much a newbie xml/rss.



0
 
Wayne BarronCommented:
Can you take a screenshot of the way that it is coming back to you?
This is the way that it suppose to look, is this what you are seeing?

Carrzkiss

Q-24370143.jpg
0
 
Wayne BarronCommented:
0
 
swaggerkingAuthor Commented:
Hey Carrzkiss,
I'm providing a screen shot. I rebooted both of my computers (mac and pc) only IE on my pc duplicated your screen shot for both of your examples. FireFox, Safari, Opera on both computers for some reason are not. Really weird. I'm providing a screen shot of your styled xml example.
rsscapture.jpg
0
 
swaggerkingAuthor Commented:
I totally get what you've shown me... minus why it only works in IE.

I would like to create Travel Special rss feed that works like cnn.com. When I click on their rss link and it opens up as feed://rss.cnn.com/rss/cnn_topstories.rss or am I just trying to compare apples to oranges.
cnntop10.jpg
0
 
Wayne BarronCommented:
And that is why I hate dealing with other browsers.
Removing the CSS line in the main .asp file, renders the file correctly.
But with the CSS attributes in place, it breaks.

I will deal with this issue sometime tomorrow.
It is: 2:12am EST right now, so I am going to get some sleep.

Talk to you tomorrow sometime.

Carrzkiss
0
 
Wayne BarronCommented:
Works across all platforms.
Working example
http://ee.cffcs.com/Q_24370143/Q_24370143.asp
Code
http://ee.cffcs.com/Q_24370143/Q_24370143.zip

What caused it to mess up in Firefox and others (Besides IE) was the fact that
Title was actually title.
(It was written as lower-case, no capital letters, thus breaking in others browsers)

Have a good one.
Carrzkiss
0
 
swaggerkingAuthor Commented:
I noticed the same thing this morning as well and got it to work. Thanks again.
0
 
Wayne BarronCommented:
What a pain.
IE is more flexible then the other browsers are.
If they really wanted to make them as good as IE, they would get rid of a lot of the limitations.

have a good one.
Carrzkiss
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 10
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now