Asp. NET to write an online RSS news aggregator

Source: Internet
Author: User
Tags file system microsoft sql server net xml xml parser

  RSS News aggregation now seems to be very popular Oh, let's play, but we want to play is: use asp.net to write an online RSS news aggregator .

Profile

This article explains how to use an XML WEB control to get remote XML data and display the XML data on a asp.net page, and publish the XML data in the database using the Repeater control. Over the past few years, the use of XML has exploded as demand for shared data between heterogeneous platforms has grown. Aware of this trend, Microsoft in the whole. NET Framework provides robust support for XML. This means that it has never been easier for asp.net developers to display and process XML data on a Web page. This article will learn XML and ASP.net technologies by generating a RSS2.0 aggregation engine and an online news aggregator. This article assumes that readers are familiar with ASP.net and XML.
Brief introduction

With the extension of office and home online time, as well as the continued explosive growth of WEB sites and accessible Internet applications, data sharing between applications is becoming increasingly important. Sharing data between heterogeneous platforms requires a platform-neutral data format that can be easily transmitted through standard Internet protocols, which is where XML comes in. Because the XML file is essentially just a text file, its coding format is well known and the existing XML parser is available to all major programming languages, so XML data can be easily used by any platform.

Web site Aggregation is an example of using XML to share data, which is often visible in news sites and blogs. Using Web site aggregation technology, Web sites can publish the latest content in XML-formatted web-accessible aggregate files. There are many kinds of aggregation formats used in Web sites, one of the most popular formats is RSS2.0. (The RSS2.0 specification is posted on the technical column of Harvard's website). In addition, MSDN Magazine has an aggregation file: MSDN Magazine: This issue, which lists articles in the latest issue of MSDN Magazine, including links to online versions of articles.

Once the Web site has a public publishing aggregation file, different clients can consume it. There are many ways to consume aggregated files, for example, a site that provides. NET technology resources may want to add the latest MSDN magazine article titles to the Web site. Aggregate files are also often used by news aggregator programs, which are specifically designed to capture and display aggregated files from different sources.

As people increasingly focus on using XML data, the ability to process XML data in asp.net pages becomes more critical than ever. Now that Web site aggregation is so important, this article will create a Web site aggregation file Builder and an online news aggregator. In creating these two micro programs, we will talk about how to access and display XML data, whether it comes from a remote Web server or a local file system. We will demonstrate how to display XML data in many different ways, such as using Repeater controls and using ASP.net XML Web controls.

Aggregate content using the RSS 2.0 specification

The first micro program we will create in this article is an aggregate file builder. For this mini program, suppose you are a web developer for a large news site (such as msnbc.com), and all news content is stored in a Microsoft SQL Server 2000 database. Specifically, these articles are all stored in a table named articles, and the following fields in the table are closely related to our program:

· Articleid-primary key, self-growing integer field, used to uniquely identify each article;

· title-Specify title, field data type: varchar (50);

· author-Specify author, field data type: varchar (50);

· description-News content Description, field data type: varchar (2000);

· Datepublished-News Release date, field data type: datetime

Note that there may be other fields in the articles table, which are just the fields that we use to create the aggregate file. Moreover, this is just a very simple data model, in the application of the database environment, you may use a more standardized database model, such as a separate authors (author) table, there is a creation of the author and the article a many-to-many relationship between the table and so on.

Next, we'll create a asp.net page with a formatted RSS2.0 XML file to display a list of the latest news. Before we talk about how to do this in the ASP.net page, let's introduce the content of the RSS2.0 specification. We should keep in mind that throughout the specification, RSS is designed to provide a data model for aggregating content. Then there is no doubt that it will have a series of XML elements that describe the content information that the Web site will aggregate, and a series of XML elements that describe a particular news item. Finally, don't forget that the RSS aggregation file is an XML format file that must conform to the criteria for XML formatting, namely:



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.