Forums

ASP

This topic is locked

Create Live XML Document From DW CS4 Recordse

Posted 08 Oct 2008 22:17:02
1
has voted
08 Oct 2008 22:17:02 Jim Thomas posted:
Hello Everybody...!

Having an issue here that I am hoping somebody can assist me with. What I am trying to do is create a real estate feed in xml/rss from a dreamweaver vb recordset. The method I am using looks like it writes the xml file from the asp file. That part is working for me, but if I add listings to the recordset, they do not get updated on the xml/rss file. I have to run the asp file again to get the updates to the xml document. Is there some way to make this work?

Here is the code from my asp file.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/MyConnectionString.asp" -->
<%
Dim rs
Dim rs_cmd
Dim rs_numRows

Set rs_cmd = Server.CreateObject ("ADODB.Command"
rs_cmd.ActiveConnection = MM_HomeownerServices_STRING
rs_cmd.CommandText = "SELECT MLNumber, ListingPrice, Address, City, County, [State] FROM TListings"
rs_cmd.Prepared = true

Set rs = rs_cmd.Execute
rs_numRows = 0

file_being_created="zTestListings.xml"

set fso = createobject("scripting.filesystemobject"

Set act = fso.CreateTextFile(server.mappath(file_being_created), true)

act.WriteLine("<?xml version=""1.0"" encoding=""ISO-8859-1""?>"
act.WriteLine("<rss version=""2.0"">"
act.WriteLine("<channel>"
act.WriteLine("<title>Cincinnati Real Estate And Homes For Sale</title>"
act.WriteLine("<description>Listings, open houses, rentals provided by your company name</description>"
act.WriteLine("<link>www.HomesOfGreaterCincinnati.com</link>")
act.WriteLine("<category>Real Estate For Sale</category>"

do while not rs.eof

counter=counter+1

act.WriteLine("<item>"
act.WriteLine("<mls>" & rs("MLNumber" & "</mls>" )
act.WriteLine("<list_price>" & rs("ListingPrice" & "</list_price>" )
act.WriteLine("<property_address>" & rs("Address" & "</property_address>"
act.WriteLine("<property_city>"& rs("City" & "</property_city>"
act.WriteLine("</item>"

rs.movenext
loop

act.WriteLine("</channel>"
act.WriteLine("</rss> "

act.close



%>

My xml document is also available for viewing through this link: www.nky-mls.com/hs_data/zTestListings.xml

I am a newbie coder here, so while I certainly appreciate your help, keep in mind you may have to explain it in a bit more detail than you might to most others.

Thank you again.

Reply to this topic