What is RSS

zhaozj2021-02-08  461

RSS (RICH Site Summary or RDF Summary) is a technology for website content integration. This technique initially originated from the browser "News Channel" is now a broader use of the company (Portal), Enterprise Application Integration (EAI).

----------------

What is rss? By Mark Pilgrim

RSS is a format for syndicating news and the content of news-like sites, including major news sites like Wired, news-oriented community sites like Slashdot, and personal weblogs. But it's not just for news. Pretty much anything that can be broken down into discrete items can be syndicated via RSS: the "recent changes" page of a wiki, a changelog of CVS checkins, even the revision history of a book Once information about each item is in RSS format, an RSS-aware program can check. The feeding for change.

RSS-aware programs called news aggregators are popular in the weblogging community. Many weblogs make content available in RSS. A news aggregator can help you keep up with all your favorite weblogs by checking their RSS feeds and displaying new items from each of them.

A brief history

But coders beware. The name "RSS" is an umbrella term for a format that spans several different versions of at least two different (but parallel) formats. The original RSS, version 0.90, was designed by Netscape as a format for building portals of headlines to mainstream news sites It was deemed overly complex for its goals;. a simpler version, 0.91, was proposed and subsequently dropped when Netscape lost interest in the portal-making business But 0.91 was picked up by another vendor, UserLand Software, which. Intended to Use it as the basis of its weblogging products and other web-based Writing Software.

In the meantime, a third, non-commercial group split off and designed a new format based on what they perceived as the original guiding principles of RSS 0.90 (before it got simplified into 0.91). This format, which is based on RDF, is called RSS 1.0. But UserLand was not involved in designing this new format, and, as an advocate of simplifying 0.90, it was not happy when RSS 1.0 was announced. Instead of accepting RSS 1.0, UserLand continued to evolve the 0.9x branch, through Versions 0.92, 0.93, 0.94, and finally 2.0.What a mess.

SO Which One Do I USE?

That's 7 - Count 'EM, 7! - Different Formats, All Called "RSS". AS A CODER OF RSS-Aware Program, You'll Need To Be Liberal Enough To Handle All The Variations. But As a Content Product PROducer Who Wants to make your content, which format shouth, which format

RSS Versions and Recommendations

VersionOwnerProsStatusRecommendation0.90Netscape Obsoleted by 1.0Don't use0.91UserLandDrop dead simpleOfficially obsoleted by 2.0, but still quite popularUse for basic syndication. Easy migration path to 2.0 if you need more flexibility0.92, 0.93, 0.94UserLandAllows richer metadata than 0.91Obsoleted by 2.0 Use 2.0 instead1.0RSS-DEV Working GroupRDF-based, extensibility via modules, not controlled by a single vendorStable core, active module developmentUse for RDF-based applications or if you need advanced modules2.0UserLandExtensibility via modules RDF-specific, easy migration path from 0.9x BranchStable Core, Active Module DevelopmentUse for General-Purpose, Metadata-Rich Syndication

What Does RSS Look Like?

Imagine you want to write a program that reads RSS feeds, so that you can publish headlines on your site, build your own portal or homegrown news aggregator, or whatever. What does an RSS feed look like? That depends on which version of RSS you 'Re Talking About. Here's A Sample RSS 0.91 feed (Adapted from XML.com's RSS feed):

Xml.com </ title> <link> http://www.xml.com/ </ link> <description> XML.com Features a Rich Mix Of Information And Services for the xml community. </ description> <language> EN-US </ language> <item> <title> Normalizing XML, Part 2 </ title> <link> http://www.xml.com/pub /a/2002/12/04/normalizing.html </ link> <description> In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and The Fourth and Fifth Normal Forms. </ description> </ item> <item> <title> The .NET Schema Object Model </ Title> <link> http://www.xml.com/pub/a/2002/ 12/04 / som.html </ link> <description> Priya Lakshminarayanan describes in detail the use of the .NET Schema Object Model for programmatic manipulation of W3C XML Schemas. </ description> </ item> <item> <title> Svg's Past and Promising Future </ Title> <link> http: // Www.xml.com/pub/a/2002/12/04/svg.html </ link> <description> in this Month's Svg Column, Antoine Quint Looks Back At Svg's Journey Through 2002 and Looks Forward to 2003. </ Description > </ Item> </ channel> </ rs s r c i i h h l l l i i l l Title, Link, And Description.</p> <p>Now Look at the RSS 1.0 Version of The Same Information:</p> <p><RDF: RDF XMLns: RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns = "http://purl.org/rss/1.0/" XMLNS: DC = "http://purl.org/dc/elements/1.1/"> <channel rdf: about = "http://www.xml.com/cs/xml/query/q/19> <title> Xml.com </ title> <link> http://www.xml.com/ </ link> <description> XML.com Features a Rich Mix of Information and services for the xml community. </ Description> <language> EN-US <RDF: SEQ> <rdf: li rdf: resource = "http://www.xml.com/pub/a/2002/12/04/normalization.html" /> <rdf: li rdf: resource = "http://www.xml.com/pub/a/2002/12/04/som.html" /> <rdf: li rdf: resource = "http: // www. Xml.com/pub/a/2002/12/04/svg.html "/> </ rdf: SEQ> <items> </ channel> <item rdf: about =" http://www.xml.com /PUB/A/2002/12/04/NORMALIZING.HTML "> <title> Normalizing XML, Part 2 </ Title> <link> http://www.xml.com/pub/a/2002/04 / Normalizing.html </ link> <description> in this second and final look at Applying RELATIONAL NORMALIZATION TECHNIQUES TO W3C XML Schema Data Modeling, Will Provost Discusses When Not to Normalize, The Scope of Uniqueess and The Fourth and Fifth Normal Forms. </ Description> <DC: Creat> Will Provost </ dc: Creator> <DC: DATE> 2002-12- 04 </ dc: DATE> </ item> <item rdf: About = "http://www.xml.com/pub/a/2002/12/04/som.html> <title> The .NET Schema Object model </ title> <link> http://www.xml.com/pub/a/2002/12/04/som.html </ link> <design></p> <p>Priya Lakshminarayanan describes in detail the use of the .NET Schema Object Model for programmatic manipulation of W3C XML Schemas </ description> <dc: creator>. Priya Lakshminarayanan </ dc: creator> <dc: date> 2002-12-04 < / DC: DATE> </ item> <item rdf: About = "http://www.xml.com/pub/a/2002/12/04/svg.html"> <title> svg's paste and promising future < / Title> <link> http://www.xml.com/pub/a/2002/12/04/svg.html </ link> <description> in this Month's Svg Column, Antoine Quint Looks Back At Svg's Journey Through 2002 and looks forward to 2003. </ Description> <dc: creator> Antoine quint </ dc: creator> <dc: date> 2002-12-04 </ dc: DATE> </ item> </ rdf: rdf> . Quite a bit more verbose People familiar with RDF will recognize this as an XML serialization of an RDF document;. the rest of the world will at least recognize that we're syndicating essentially the same information In fact, we're including a bit More Information: Item-Level Authors and Publishing Dates, Which RSS 0.91 Does Not Support.</p> <p>By Mark Pilgrim</p> <p>Despite being RDF / XML, RSS 1.0 is structurally similar to previous versions of RSS - similar enough that we can simply treat it as XML and write a single function to extract information out of either an RSS 0.91 or RSS 1.0 feed However, there. Area Significant Differences That Our Code Will Need To Be aware of:</p> <p>The root element is rdf:. RDF instead of rss We'll either need to handle both explicitly or just ignore the name of the root element altogether and blindly look for useful information inside it RSS 1.0 uses namespaces extensively The RSS 1.0 namespace is.. Http://purl.org/rss/1.0/, and it's defined as the default namespace. The feed also buy http://www.w3.org/1999/02/22-rdf-syntax-ns# for the rdf -Specific Elements (Which We'll SIMPLY BE IGNORING for Our Purposes) and http://purl.org/dc/elements/1.1/ (DUBLIN CORE) for The Additional Metadata of Article Authors and Publishing Dates. We can go in one of two ways here: if we do not have a namespace-aware XML parser, we can blindly assume that the feed uses the standard prefixes and default namespace and look for item elements and dc:. creator elements within them This will actually work in a large number of real-world case; MOST RSS feeds use the defixes for Common Modules Like Dublin Core. This is a horribl e Hack, Though. There's no guarance, the same one, the same one, a different (Which Would Be Perfectly Valid XML and RDF). if or when it does, we'll miss it. if we have name Aware XML Parser At Our Disposal, We can construct A More Elegant Solution That Handles Both RSS 0.91 and 1.0 feeds. we can ike for items in no namespace;</p> <p>IF That Fails, We can Items in the RSS 1.0 Namespace. (Not Shown, But RSS 0.90 Feeds Also Use A Namespace, But Not The Same ONE AS RSS 1.0. So What We Really NEED IS A List of Namespaces To Search. ) Less obvious but still important, the item elements are outside the channel element (in RSS 0.91, the item elements were inside the channel in RSS 0.90, they were outside;.... in RSS 2.0, they're inside Whee) So we can not be picky about where we look for items. Finally, you'll notice there is an extra items element within the channel. It's only useful to RDF parsers, and we're going to ignore it and assume that the order of the items within the RSS feed is given by their order of the item elements.But what about RSS 2.0? luckily, once we've written code to handle RSS 0.91 and 1.0, RSS 2.0 is a piece of cake. Here's the RSS 2.0 version Of The Same Feed:</p> <p><RSS Version = "2.0" XMLns: DC = "http://purl.org/dc/elements/1.1/"> <channel> <title> xml.com </ title> <link> http: // www. Xml.com / </ link> <description> XML.com Features a Rich Mix of Information and Services for the XML Community. </ description> <Language> En-US </ Language> <item> <title> Normalizing XML, Part 2 </ title> <link> http://www.xml.com/pub/a/2002/12/04/normalization.html </ link> <description> in this second and final look at Applying Relational Normalization Techniques, THIS to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms </ description>. <dc: creator> Will Provost </ dc: creator> <dc: date> 2002 -12-04 </ dc: Date> </ item> <item> <title> The .NET Schema Object Model </ title> <link> http://www.xml.com/pub/a/2002/12 / 04/som.html </ link> <description> Priya Lakshminarayanan Describes in detil the use of the .net schema Object Model for Programmatic Manipulation O F W3C XML Schemas. </ Description> <dc: Creator> Priya Lakshminarayanan </ dc: Creat> <DC: DATE> 2002-12-04 <Item: DATE> </ item> <item> <title> svg's paste And Promising Future </ title> <link> http://www.xml.com/pub/a/2002/12/04/svg.html </ link> <description> in this Month's Svg Column, Antoine Quint Looks Back At Svg's Journey THROUGH 2002 and Looks Forward to 2003. </ Description> <DC: Creator> Antoine Quint </ dc: Creator> <</p> <p>DC: DATE> 2002-12-04 </ DC: DATE> </ ITEM> </ channel> </ rss> As this Example Shows, RSS 2.0 Uses Namespaces Like RSS 1.0, But It's Not Rdf. Like RSS 0.91, There IS NO Default Namespace and Items Are Back Inside The Channel. IF out Is LibERAL ENOUGH To Handle The Differences Between RSS 0.91 and 1.0, RSS 2.0 Should Not Present Any Additional Wrinkles.</p> <p>How Can I Read RSS?</p> <p>Now let's get down to actually reading these sample RSS feeds from Python The first thing we'll need to do is download some RSS feeds This is simple in Python;.. Most distributions come with both a URL retrieval library and an XML parser (. Note to Mac OS X 10.2 Users: your copy of python does NOT COME WITH AN XML PARSER; You will need to install pyxml first.)</p> <p>From xml.dom import minidomimport urllibdef loading (rsssurl): return minidom.parse (Urllib.urlopen (Rssurl))</p> <p>This Takes The Url of an RSS feed and return a parse 帖子 帖子 OF AS NATIVE PYTHON Objects.</p> <p>The next bit is the tricky part. To compensate for the differences in RSS formats, we'll need a function that searches for specific elements in any number of namespaces. Python's XML library includes a getElementsByTagNameNS which takes a namespace and a tag name, so we'll use that to make our code general enough to handle RSS 0.9x / 2.0 (which has no default namespace), RSS 1.0 and even RSS 0.90. This function will find all elements with a given name, anywhere within a node. that's ........................ ..</p> <p>Default_namespaces = / (none, # rss 0.91, 0.92, 0.93, 0.94, 2.0 'http://purl.org/rss/1.0/', # rss 1.0 'http://my.netscape.com/rdf/simple/ 0.9 / '# RSS 0.90) def getElementsByTagName (node, tagName, possibleNamespaces = DEFAULT_NAMESPACES): for namespace in possibleNamespaces: children = node.getElementsByTagNameNS (namespace, tagName) if len (children): return children return [] Finally, we need two utility functions to make our lives easier. First, our getElementsByTagName function will return a list of elements, but most of the time we know there's only going to be one. An item only has one title, one link, one description, and so on . We'll define a first function that returns the first element of a given name (again, searching across several different namespaces). Second, Python's XML libraries are great at parsing an XML document into nodes, but not that helpful at putting the data Back together again. We'll Define a Textof Function That Returns The Entire Text of a Particular XML ELEMENT.</p> <p>def first (node, tagName, possibleNamespaces = DEFAULT_NAMESPACES): children = getElementsByTagName (node, tagName, possibleNamespaces) return len (children) and children [0] or Nonedef textOf (node): return node and "" .join ([child. Data for child in node.childnodes]) OR ""</p> <p>That's it. The actual paarsing is easy. We'll Take a Url on The Command Line, Download IT, Parse It, Get The List of items, and the get some useful information from Each Item:</p> <p>DUBLIN_CORE = ('http://purl.org/dc/elements/1.1/' ,)if __name__ == '__main__': import sys rssdocument = loading (sys.argv [1]) for item in getElementsBytagname (RssDocument, ' item '): Print' Title: ', Textof (Item,' Title ')) Print' Link: ', Textof (Item,' Link ')) Print' Description: ', Textof (item, 'Description')) Print 'Date:', Textof (Item, 'Date', Dublin_CORE) Print 'Author:', Textof (Item, 'Creat', Dublin_CORE) Printrunning It With Our Sample RSS 0.91 Feed Prints Only Title, Link, And Description (Since The Feed Didn't Include ANY Other Information on Dates or Authors):</p> <p>$ Python Rss1.py http://www.xml.com/2002/12/18/examples/rs091.xml.txtTtitle: Normalizing XML, Part 2 Link: http://www.xml.com/pub/a/2002 /12/04/normalizing.htmldescription: In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms.date: author : title: The .NET Schema Object Modellink: http://www.xml.com/pub/a/2002/12/04/som.htmldescription: Priya Lakshminarayanan describes in detail the use of the .NET Schema Object Model for programmatic Manipulation of W3C XML Schemas.date: Author: Title: Svg's Past and Promising FutureLink: http://www.xml.com/pub/a/2002/04/svg.htmldescription: in this Month's Svg Column, Antoine Quint Looks Back At Svg's Journey THROUGH 2002 and Looks Forward to 2003.Date: Author:</p> <p>For both the sample RSS 1.0 feed and sample RSS 2.0 feed, we also get dates and authors for each item. We reuse our custom getElementsByTagName function, but pass in the Dublin Core namespace and appropriate tag name. We could reuse this same function to extract . information from any of the basic RSS modules (There are a few advanced modules specific to RSS 1.0 that would require a full RDF parser, but they are not widely deployed in public RSS feeds.) Here's the output against our sample RSS 1.0 feed:</p> <p>$ Python Rss1.py http://www.xml.com/2002/12/18/examples/rss10.xml.txttitle: Normalizing XML, Part 2 Link: http://www.xml.com/pub/a/2002 /12/04/normalizing.htmldescription: In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms.date: 2002 -12-04Author: Will ProvostTitle: The .Net Schema Object Modellink: http://www.xml.com/pub/a/2002/12/04/som.htmldescription: priya lakedshminarayanan describes in detail the user of the .net Schema Object Model for programmatic manipulation of W3C XML Schemas.date: 2002-12-04author: Priya Lakshminarayanantitle: SVG's Past and Promising Futurelink: http://www.xml.com/pub/a/2002/12/04/svg. HTMLDESCRIPTION: INTH's SVG Column, Antoine Quint Looks Back At Svg's Journey Through 2002 and Looks Forward to 2003.Date: 2002-12-04author: Antoine Quint</p> <p>Running Against Our Sample RSS 2.0 Feed Products The Same Results.</p> <p>This technique will handle about 90% of the RSS feeds out there; the rest are ill-formed in a variety of interesting ways, mostly caused by non-XML-aware publishing tools building feeds out of templates and not respecting basic XML well-formedness Rules. Next Month We'll Tackle The Thorny Problem of How To Handle Rss Feeds That Are Almost, But Not Quite, Well-Formed Xml.related Resources</p> <p>Sample RSS feeds: RSS 0.91, RSS 1.0, RSS 2.0 rss1.py Specifications:. RSS 0.90, RSS 0.91, RSS 1.0, RSS 2.0 Syndic8.com, a directory of 10,000 publicly available RSS feeds News Readers in the Open Directory,.. A Variety of Client-Side and Server-Side Programs forreading RSS feeds.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-686.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="686" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.048</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '8ZsAYJJ1W5CAXUEY22ftLerFzCqA3NvqYuOEcvsg8hI8zvcq1UvwT_2BFPlLfn2xtG7uT8_2BCvl2Tz1n_2FD5Zoo35w_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>