RSS Learning (iii) RSS 2.0

Source: Internet
Author: User
Tags rss parser movable type
RSS 2.0

1.New Features of rss2.0 RSS 2.0 is based on the RSS 0.91 standard. It is backward compatible, so any tool that processes RSS 2.0 should be able to process 0.91 feeds. A few elements are added to the upgraded specifications, such as <cloud> and <guid>. It also removes some restrictions. In the past, <
The link> and <URL> elements can only be HTTP or FTP, and now any valid URI can be used. In RSS 0.91
, Each channel can only contain 15
Item, and the length of the element is also limited. These restrictions are now removed. However, you should still be careful when using large values because they may apply to old applications. Program Cause problems. However, a bigger change is the ability to extend the format using namespaces. RSS 2.0 supports namespaces, a standard method for adding elements not included in a specification. A feed can contain new elements as long as it is defined in a namespace. 2.RSS 2.0 Overview RSS is an XML dialect used to link web content and metadata. RSS 0.91 is one of the most common available versions. For the New RSS feed, a better way is to use version 2.0, because this is the current specification, and as mentioned above, it is backward compatible with version 0.91. Dave winer wrote the standard 2.0
. Modifications to specifications may become difficult to use, or damage existing applications, which he consciously avoids. Winer summarized his idea: "Keep It Simple. This is RSS.
. Anyone who knows HTML a little can understand RSS. This is extremely important !" This specification is published with the Creative Commons license (see references ). This means that you can copy and distribute the specification for free, perform derivative work, and use it freely for business purposes. An advisory committee is responsible for updating specifications, promoting specifications, and preparing documents. 3.RSS feed found You can use the search engine to find the content in the RSS format. For example, when Google is used, you can add "filetype: RSS" to search for items in the. RSS file. Dedicated search engines make content search easier. Feedster
Monitors weblog and allows you to search by index of a log item, which can be viewed by correlation, date, and level (logrank. When you are searching, feedster
Create an RSS feed as required. This feed can be added to your news reader so that you can see all the latest events related to search requests. You do not even need to leave the news reader. Daypop searches for news, blogs, and RSS
Abstract. It allows you to track popular news in the weblog world. It provides the most popular 40 weblog links. This is the world's most popular Article . It creates
The list of the most popular words used in weblog. It also provides the weblog that is most popular with other weblogger Based on the referenced weblog rating.
List. You can also customize the search. Both the rating list and Custom Search are in the form of RSS feeds, which can be imported to your news reader. 4.RSS File Format An RSS file is composed
<Channel> elements and their child elements. In addition to the channel content, <channel> also contains elements that represent channel metadata in the form of items.
-- For example, <title>, <link>, and
<Description>. Item is usually the main part of the channel, including frequently changing content. 4.1.Channels A channel generally has three elements that provide information about the channel itself: <title>: the name of the channel or feed. <Link>: the URL of the website or site area associated with the channel. <Description>: briefly introduces what the channel is. Many channel sub-elements are optional. The commonly used <image> element contains three required sub-elements: <URL>: the URL of the GIF, JPEG, or PNG image of the channel. <Title>: Description of the image. When the channel is rendered in HTML, it is used as the alt attribute of the HTML <image> tag. <Link>: the URL of the site. If the channel is rendered in HTML, the image serves as a link to the site. <Image> there are three optional sub-elements: <width>: Number, indicating the pixel width of the image. The maximum value is 188 and the default value is 88. <Height>: Number, indicating the pixel height of the image. The maximum value is 400. The default value is 31. <Description>: contains text, which can be used as the title attribute of the link element formed around the image during rendering. You can also use many other optional channel elements. Most are self-explanatory: <language>: En-US <copyright>: Copyright 2003, James Lewin <managingeditor>: dan@spam_me.com (Dan deletekey) <webmaster>: dan@spam_me.com (Dan deletekey) <pubdate>: sat, 15 Nov 2003 0:00:01 GMT <lastbuilddate>: sat, 15 Nov 2003 0:00:01 GMT <Category>: eBusiness <generator>: Your CMS 2.0 <docs>: http://blogs.law.harvard.edu/tech/rss <cloud>: allows the process to register as cloud, notifies it when the channel is updated, implementing a lightweight publish-subscribe protocol for the RSS feed. <TTL>: The survival time is a number that indicates the number of minutes that the feed is buffered before refreshing. <Rating>: pics rating of this channel. <Textinput>: defines an input box that can be displayed with a channel. <Skiphours>: indicates which hours of updates can be ignored by the clustering tool. <Skipdays>: indicates that updates on the day of the clustering can be ignored. 4.2.Item Items are usually the most important part of the abstract. Each item can record a weblog, complete documentation, movie comments, classified ads, or any content that you want to link to a channel. Other elements in the channel may remain unchanged, but the items change frequently. You can have any number of items. The previous standard limit is 15 items. To maintain backward compatibility, this is still a good limit. 4.3.Elements of news items Each item usually contains three elements: <title>: the name of the item, which is converted to the title in HTML in a standard application. <Link>: This is the URL of the item. Title is usually used as a link to point to the url contained in the <link> element. <Description>: it is usually used as a summary or supplement of the URL pointed to in the link. All elements are optional, but an item must contain at least one <title> or <description>. <Author>: the author's e-mail address. <Category>: supports organized records. <Comments>: the URL of the comment page of the item. <Enclosure>: media objects related to this item are supported. <Guid>: the unique permanent link associated with the item. <Pubdate>: When is the item released. <Source>: the RSS feed from which the item comes from. It is useful when items are aggregated. Listing 1 is an example of an RSS 2.0 file. Note that the channel is included in <RSS version = "2.0">. This is a very basic example of how items and images are included in a channel. The shown elements are the most common channel sub-elements. Listing 1. Sample RSS 2.0 file <? XML version = "1.0"?> & Lt; RSS version = "2.0" & gt; <Channel> <Title> the channel's name goes here </title> <Link> http://www.urlofthechannel.com/</link> <Description> This channel is an example channel for an article. </Description> <Language> en-US </language> <Image> <Title> the image title goes here </title> <URL> http://www.urlofthechannel.com/images/logo.gif </URL> <Link> http://www.urlofthechannel.com/</link> </Image> <Item> <Title> the future of content </title> <Link> http://www.itworld.com/nl/ecom_in_act/11122003/ </link> <Description> the issue of people distributing and Reusing Digital media is a problem for other businesses. It may also be A hidden opportunity. Just as open source licensing has opened Up new possibilities in the world of technology, it promises to do The same in the area of creative content. </description> </Item> <Item> <Title> online music services-better than free? </Title> <Link> http://www.itworld.com/nl/ecom_in_act/08202003/ </link> <Description> more people than ever are downloading music from The Internet. Please use person-to-person file sharing programs like KaZaA to share and download music in MP3 format, paying nothing. This has made it difficult for companies to setup online music Businesses. How can companies compete against free? </Description> </Item> </Channel> </RSS> 5.Related tools Thanks to the popularity of RSS, many tools have emerged, allowing you to basically use these files in any environment: Java technology: an RSS utilities package that can be found on the sun site, you can use the tag library in assumerver pages. It also includes an RSS parser. Perl: Several Perl tools are available to process RSS. XML: RSS provides a framework for creating and maintaining RSS files. It supports conversion between common versions. Python: RSS. py is a group of classes that use RSS channels through python. In addition, many content management and weblog tools also directly support RSS. Most weblog tools, including movable type, blogger, and radio userland, support RSS. Some content management systems, including Zope and citydesk, now support it. 6.Extended RSS RSS 2.0
There are many optional elements, including those required by most channels. But it also supports scalability, so you can use elements not in the specification. However, RSS 2.0
The specification does not take much time to define how to scale. For scalability, the criterion is summarized as: "RSS
The abstract can contain elements not described on this page, as long as these elements are defined in a namespace ." This leaves a lot of imagination! Fortunately, the specification contains an example. You can refer to the following examples. The basic idea is that you can add the required labels --
However, it is too easy to add elements with multiple meanings. People using your channel may not know what a tag means. For example, if I want to use
<Analog> the meaning of the label is unclear. Web experts may think that this label refers to analog, which is the most popular Web log.
File analyzer. Sci-fi fans may think this label is about analog
A classic sci-fi magazine. A musician may think it refers to a popular synthesizer type. A biologist thinks it is an organ and an electronic engineer thinks it is a circuit. Ambiguity makes it hard for people to understand the inclusion of tags.
. Therefore, RSS allows you to add any label you like, but must be used with the namespace. This helps clarify the meaning of tags. Return to the <analog> example. I may want to create a group of E-commerce tags and use the <analog> tag as an "e-Business" element. To do this, I add the following namespace: xmlns: eBusiness = "http://www.lewingroup.com/ebusinessChannel" which creates a name named "eBusiness" empty
And indicate that the document of this namespace is on my site. To use <analog>
Label: <eBusiness: analog>. In this way, it can be separated from other similar meanings, such
<Sciencefiction: analog> or <synthesizers: analog>. For more practical examples of scalability, you can find the following in the sample file of the RSS 2.0 specification: List 2. namespace in the sample file of the RSS 2.0 specification <? XML version = "1.0"?> <! -- RSS generated by Radio userland v8.0.5 on 9/30/2002; 4:00:00 am Pacific --> <RSS version = "2.0" xmlns: blogchannel = "http://backend.userland.com/blogChannelModule"> <channel> <Title> scripting news </title> <Link> http://www.scripting.com/</link> <Description> a weblog about scripting and stuff like that. </description> <Language> en-US </language> <Blogchannel: blogroll> Http://radio.weblogs.com/0001015/userland/scriptingNewsLeftLinks.opml </Blogchannel: blogroll> <Item> <Description> Joshua Allen: <A href = "http://www.netcrucible.com/blog/2002/09/29.html#a243"> Who loves namespaces? </A> </description> <Pubdate> Sun, 29 Sep 2002 19:59:01 GMT </pubdate> <Guid> Http://scriptingnews.userland.com/backissues/2002/09/29#When:12:59:01PM </GUID> </Item> </Channel> </RSS> in this example,
The namespace of the blogchannel. It points to a document that explains the usage of several new elements that are common in weblog. One of them is
<Blogroll>. Document Description: blogroll is a link set in weblog and points to the site related to your weblog content. <Blogchannel: blogroll> the TAG provides the information required by the user or software. It is known that blogroll is an element defined in the blogchannel namespace, and the location of this document can be found. Similarly, RSS 2.0 only requires namespaces for non-standard elements. All basic labels are assumed to be in the RSS 2.0 namespace. This makes the format easier to use, because you do not need to know the namespace unless you need to extend RSS.

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.