473,466 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XML Generator - Plan of Attack

jay
Hello all,

I'd like to probe the community for some insight, if I may. I am in the
planning stages of developing an XML generator for my workplace.

Our site has an internal news system which stores news items as
database entries. Our head organization has requested that all branches
make an rss or xml file available for syndication on their central news
site. I'm curious as to what plan of attack would be best suited for
this application.

I'm working in VS.NET 2003, Windows 2000, SQL Server 2000.

Web service, ASPNET page? How about caching? Any thoughts or insights
would be helpful. Thanks for your time! :)

-Jay

Nov 17 '05 #1
8 1254
Jay,

Well, first, I would look for something that already generates RSS
documents. If I recall correctly, dot net nuke has an RSS component which
you could use.

Even so, from what I know, RSS doesn't have a terribly complex schema,
so you could generate it on your own, if you wish. You just have to choose
how much you are going to pipe (you can't very well pipe everything on each
request, you need to stop somewhere).

As for distribution, I don't think that a web service is appropriate
here. The reason for this is that the delivery of RSS feeds is already set,
and it's a simple XML result over an HTTP request. A web service would
complicate that needlessly.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ja*@gloryfish.org> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hello all,

I'd like to probe the community for some insight, if I may. I am in the
planning stages of developing an XML generator for my workplace.

Our site has an internal news system which stores news items as
database entries. Our head organization has requested that all branches
make an rss or xml file available for syndication on their central news
site. I'm curious as to what plan of attack would be best suited for
this application.

I'm working in VS.NET 2003, Windows 2000, SQL Server 2000.

Web service, ASPNET page? How about caching? Any thoughts or insights
would be helpful. Thanks for your time! :)

-Jay

Nov 17 '05 #2
How often does the news change?

I assume that you will give the location of the file to the head
organisation who will grab it occasionally?

The simplest way would be to spit out a static .xml/.rss file whenever the
news is changed. Could this be added to the news system, i.e. do you have
access to the source of it, or would it need to be a separate little
app/service that polls the database occasionally?

Jevon
<ja*@gloryfish.org> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hello all,

I'd like to probe the community for some insight, if I may. I am in the
planning stages of developing an XML generator for my workplace.

Our site has an internal news system which stores news items as
database entries. Our head organization has requested that all branches
make an rss or xml file available for syndication on their central news
site. I'm curious as to what plan of attack would be best suited for
this application.

I'm working in VS.NET 2003, Windows 2000, SQL Server 2000.

Web service, ASPNET page? How about caching? Any thoughts or insights
would be helpful. Thanks for your time! :)

-Jay

Nov 17 '05 #3
jay
Thanks for the input!
As for distribution, I don't think that a web service is appropriate
here. The reason for this is that the delivery of RSS feeds is already set,
and it's a simple XML result over an HTTP request. A web service would
complicate that needlessly.
That makes sense.
How often does the news change?
Only a few times a day.
I assume that you will give the location of the file to the head
organisation who will grab it occasionally?
Exactly.
The simplest way would be to spit out a static .xml/.rss file whenever the
news is changed. Could this be added to the news system, i.e. do you
have access to the source of it, or would it need to be a separate little
app/service that polls the database occasionally?


I have all of the source. It probably would be simple to create a class
that generates a "top 10 news posts" XML file and then call that every
time someone adds a news item. That would also ensure that the file is
always up-to-date.

Nov 17 '05 #4
I would go with pure XML. You can then output it as any format you choose,
RSS, HTML, Text, and any other document format you choose, by applying XSL
transforms on it.

It might be good to generate this XML with a serialzable class. The class
could query the database to populate itself, and then serialze itself to a
string, a stream, a file, etc.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

<ja*@gloryfish.org> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Thanks for the input!
As for distribution, I don't think that a web service is appropriate
here. The reason for this is that the delivery of RSS feeds is already
set,
and it's a simple XML result over an HTTP request. A web service would
complicate that needlessly.


That makes sense.
How often does the news change?


Only a few times a day.
I assume that you will give the location of the file to the head
organisation who will grab it occasionally?


Exactly.
The simplest way would be to spit out a static .xml/.rss file whenever the
news is changed. Could this be added to the news system, i.e. do you
have access to the source of it, or would it need to be a separate little
app/service that polls the database occasionally?


I have all of the source. It probably would be simple to create a class
that generates a "top 10 news posts" XML file and then call that every
time someone adds a news item. That would also ensure that the file is
always up-to-date.

Nov 17 '05 #5
As Nicholas says, RSS is simple enough and you can create an RSS feed
easily.

It should be a XML response to an HTTP request and I format only the last 10
entries in my feeds and expect the RSS reader to cache the entries it has
seen. If you turn the RSS reader off for a period of time longer than the
distribution rate you're probably not going to be vastly interested in the
"news" anyway.

After my signature is a listing for a simple RSS feed provider that I use on
one of my sites... It's quick and dirty but it seems to work fine.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

/// <summary>

/// Summary description for rss.

/// </summary>

public class rss : System.Web.UI.Page

{
private void Page_Load(object sender, System.EventArgs e)

{
}

#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}

protected override void Render(HtmlTextWriter writer)

{

this.Response.ContentType="application/xml";

OleDbConnection cnx=new
OleDbConnection(Constants.NEWSConnectionString(Ser ver));

OleDbCommand cmd=new OleDbCommand(@"SELECT TOP 10 newsitems.newsitemid,
newsitems.date, newsitems.title, newsitems.description

FROM newsitems

ORDER BY newsitems.date DESC;

",cnx);

cnx.Open();

OleDbDataReader rdr=cmd.ExecuteReader();

writer.WriteLine("<?xml version=\"1.0\"?>");

writer.WriteLine("<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS
0.91//EN\" \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">");

writer.WriteLine(" <rss version=\"0.91\">");

writer.WriteLine(" <channel>");

writer.WriteLine(" <!-- Channel Information -->");

writer.WriteLine(" <title>Your newsfeed title goes here</title>");

writer.WriteLine(" <link>http://www.yourlink.com</link>");

writer.WriteLine(" <description>This is some blurb</description>");

writer.WriteLine(" <language>en-us</language>");

if(rdr.HasRows)

{

while(rdr.Read())

{

writer.WriteLine(" <!-- Item details -->");

writer.WriteLine(" <item>");

writer.WriteLine(string.Format("
<title>{0}</title>",rdr["title"].ToString()));

writer.WriteLine(string.Format("
<description>{0}</description>",rdr["description"].ToString()));

writer.WriteLine(string.Format("
<link>{0}?item={1}</link>",Constants.NewsContentUrl,
rdr["newsitemid"].ToString()));

writer.WriteLine(" </item>");

writer.WriteLine(" <!-- End Item details -->");

}

}

writer.WriteLine(" </channel>");

writer.WriteLine(" </rss>");

writer.Flush();

}


<ja*@gloryfish.org> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hello all,

I'd like to probe the community for some insight, if I may. I am in the
planning stages of developing an XML generator for my workplace.

Our site has an internal news system which stores news items as
database entries. Our head organization has requested that all branches
make an rss or xml file available for syndication on their central news
site. I'm curious as to what plan of attack would be best suited for
this application.

I'm working in VS.NET 2003, Windows 2000, SQL Server 2000.

Web service, ASPNET page? How about caching? Any thoughts or insights
would be helpful. Thanks for your time! :)

-Jay

Nov 17 '05 #6
You might have a look at the following MSDN article

http://msdn.microsoft.com/msdnmag/is...s/default.aspx

It includes a reference to example code for generating an RSS feed for
a website using a ASP.Net Repeater control and a datasource/dataset.
hth,
Alan.

Nov 17 '05 #7
jay
Wow guys! This is all great. I had been looking at using an XSLT to
convert a DataSet.GetXML file to the xml format requested by our head.
However, it might be simpler (as I'm not really familiar with XSLT) to
generate it on the fly directly from the database. Thanks again for all
of the great input.

I'm going to follow this thread for a while and see what options are
out there before I begin. :)

Nov 17 '05 #8
jay
Bob,

The code you supplied works beautifully. It's always so helpful to have
a working example to go from when you are trying to learn something
new. My job provides a lot of book-type resources but it takes a while
to sift through them when I'm tackling a specific problem. Now I know
what I really need to brush up on. :)

Kevin,

Is a serializable class similar to the approach Bob suggested?

Nov 17 '05 #9

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

Similar topics

9
by: charlie fortune | last post by:
I am making a random name generator, it will pick two or three words from a list and turn them into a name. It seems a database needs to work with name/value pairs, so am I right in thinking for a...
72
by: Raymond Hettinger | last post by:
Peter Norvig's creative thinking triggered renewed interest in PEP 289. That led to a number of contributors helping to re-work the pep details into a form that has been well received on the...
9
by: Francis Avila | last post by:
A little annoyed one day that I couldn't use the statefulness of generators as "resumable functions", I came across Hettinger's PEP 288 (http://www.python.org/peps/pep-0288.html, still listed as...
4
by: Wai Yip Tung | last post by:
I'm attempting to turn some process than uses callback to return result into a more user friendly generator. I'm hitting some road block so any pointer would be appriciated. Let say there is an...
45
by: Joh | last post by:
hello, i'm trying to understand how i could build following consecutive sets from a root one using generator : l = would like to produce : , , , ,
1
by: Mir Nazim | last post by:
Hi, I m planning to use ZODB for an applicaton. Is any one aware of report generators like Data Vision, Crystal Reports, fo python object databases. Some of you may have faced/solved similar...
3
by: Mike Brown | last post by:
I have questions about thread safety in the 'random' module. When using the random.Random class (be it Mersenne Twister or Wichmann-Hill based), is it sufficiently thread-safe (preserving entropy...
0
by: jay | last post by:
Hello all, I'd like to probe the community for some insight, if I may. I am in the planning stages of developing an XML generator for my workplace. Our site has an internal news system which...
0
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web...
2
Frinavale
by: Frinavale | last post by:
SQL Injection Attack A database is a collection of information organised in such a way that allows computer programs to access data (even large amounts) quickly and easily. Data within a database is...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.