473,387 Members | 1,585 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,387 software developers and data experts.

RSS feed <> sql server <> aspx <> xml <> blog

I have been researching articles on google on how to create a simple RSS
feed that sucks <title><blurb><link><date> out of a sql server 2000 database
via an aspx page.

I know it has to be pushed into a <xml> document but not sure which
direction to take.

Is there perhaps a starter document which uses sql server as the data source
I can tap into.

I am a newbie to aspx but I it appears there is a lot of inbuilt support for
this application and I don't wish to go down to many wrong paths or reinvent
the wheel.

Any advice appreciated!

Jason

ps: It appears that <rss> is tied in heavily with <blogs> these days....is
anyone come up with a combined solution?
Nov 19 '05 #1
3 2737
Here's the meat of the the rss.aspx that I use for blogabond.com. As
you can see, it's just a single repeater dumping out XML instead of
HTML. Couldn't be much simpler, though you'll need to remember to set
the ContentType on the server:

Page.Response.ContentType = "text/xml";

<?xml version="1.0" ?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
<channel>
<title>Blogabond.com - Livin' large in the third world</title>
<link>http://www.blogabond.com/</link>
<description>Travel journals and photo blogs from world travellers.
Maps, research and resources for the aspiring vagabond.</description>
<dc:language>en-US</dc:language>
<dc:creator></dc:creator>
<copyright>Copyright © 2005, Blogabond.com</copyright>
<sy:updatePeriod>daily</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>1</sy:updateBase>
<asp:Repeater ID="rptComments" Runat=server>
<ItemTemplate>
<item>
<title><%# DataBinder.Eval(Container.DataItem,
"CommentTitle")%></title>
<description><![CDATA[<%# GetDescription(
DataBinder.Eval(Container.DataItem, "CommentText"),
DataBinder.Eval(Container.DataItem, "UserID") )%>]]></description>
<author><%# GetAuthorName( DataBinder.Eval(Container.DataItem,
"UserID") )%></author>
<category><%# GetLocationName( DataBinder.Eval(Container.DataItem,
"LocationID") )%></category>
<pubDate><%# GetPubDate( DataBinder.Eval(Container.DataItem,
"CommentDate") )%></pubDate>
<link>http://www.blogabond.com/TripView.aspx?tripID=<%#
DataBinder.Eval(Container.DataItem, "TripID")%></link>
<guid
isPermaLink="true">http://www.blogabond.com/CommentView.aspx?commentID=<%#
DataBinder.Eval(Container.DataItem, "CommentID")%></guid>
<slash:comments>0</slash:comments>
</item>
</ItemTemplate>
</asp:Repeater>
</channel>
</rss>

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/

Nov 19 '05 #2
Dude, awesome - its been a long time since anyone has posted a full set of
example code for an inept <newbie /> such as myself. :)) Thanks!!

My first stupid question:

I sucked your code into aspx container page in web matrix (free) and tried
executing and obviously it generates a compile error with regards the
content type.

How do I actually insert the content type onto the page below?

I have done some searches on 'content type examples text/xml'.

I pick up a compilation error when I add this to the page:

<%Page ContentType="Text/Xml">

What am I doing wrong?

Nov 19 '05 #3
That needs to live on the codebehind (or possibly in a <script
runat=server> if you're not using codebehinds). Here is a small chunk
of mine. Obviously you'll need to generate your own dataset to bind
the repeater, and you'll need to write your own helper functions to
format dates and HtmlEntityEncode strings:

protected Repeater rptComments;

private void Page_Load(object sender, System.EventArgs e)
{
Page.Response.ContentType = "text/xml";

DataView dv = TripReportComment.List().Tables[0].DefaultView;
dv.Sort = Comment.Columns.CommentDate + " desc";

rptComments.DataSource = dv;
rptComments.DataBind();

}

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/

Nov 19 '05 #4

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

Similar topics

2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
3
by: z. f. | last post by:
Hi, i'm using code in my aspx page. i have data binding where i use <%# Container.DataItem("DateStart") %> i also use code that makes a loop inside a regular <% %> block how can i pass...
0
by: Adam | last post by:
Hi I split aspx for 1. aspx - www 2. vb But i have problem because Statement is not valid in a namespace. I don't know while this don't power becouse befor split wab all OK Please Help Me...
5
by: ad | last post by:
I find there are some tag like <%= %> and <%# > in my .aspx file. What is the diffreence between <%= %> and <%# %>
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
2
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! ...
4
by: emanning | last post by:
I'm having problems using "<>" as criteria for a varchar column in a view. The data in this column is '2008-2009' which is supposed to mean year 2008 thru 2009. If I set the criteria to "=...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.