RSS 7 January 2019 OSU CSE 1
R eally S imple S yndication • A textual format used on the web for “news feeds” or “web feeds” is RSS – Uses XML to represent information that is frequently updated (e.g., news, weather, sports scores, blogs), generally in summary form with links to originals – Became a de facto standard in the early 2000s • Actually, two standards; we will use RSS 2.0, a.k.a. RSS 2.* 7 January 2019 OSU CSE 2
Relationship of RSS to XML • An RSS 2.0 feed is well-formed XML • An RSS 2.0 feed meets additional specifications beyond being XML: certain tags, certain required/optional attributes, certain required/optional elements, etc. 7 January 2019 OSU CSE 3
Example RSS Feed <rss version="2.0"> <channel> <title>Yahoo! News</title> <link>http://news.yahoo.com</link> <description>The latest news and headlines from Yahoo! News. </description> <item> <title>Apple seeks to stop…</title> <link>http://news.yahoo.com/...</link> <description>Apple Inc will seek a...</description> <pubDate>Mon, 27 Aug 2012 14:40:49</pubDate> <source url="http://www.reuters.com">Reuters</source> </item> ... </channel> </rss> 7 January 2019 OSU CSE 4
Example RSS Feed <rss version="2.0"> <channel> <title>Yahoo! News</title> The top-level element is <link>http://news.yahoo.com</link> rss , and it has a required <description>The latest news and headlines from Yahoo! News. version attribute whose </description> <item> value must be "2.0" . <title>Apple seeks to stop…</title> <link>http://news.yahoo.com/...</link> <description>Apple Inc will seek a...</description> <pubDate>Mon, 27 Aug 2012 14:40:49</pubDate> <source url="http://www.reuters.com">Reuters</source> </item> ... </channel> </rss> 7 January 2019 OSU CSE 5
Example RSS Feed <rss version="2.0"> <channel> <title>Yahoo! News</title> <link>http://news.yahoo.com</link> <description>The latest news and headlines from Yahoo! News. </description> <item> There is exactly one <title>Apple seeks to stop…</title> required channel element <link>http://news.yahoo.com/...</link> <description>Apple Inc will seek a...</description> inside the rss element. <pubDate>Mon, 27 Aug 2012 14:40:49</pubDate> <source url="http://www.reuters.com">Reuters</source> </item> ... </channel> </rss> 7 January 2019 OSU CSE 6
Example RSS Feed <rss version="2.0"> <channel> <title>Yahoo! News</title> <link>http://news.yahoo.com</link> <description>The latest news and headlines from Yahoo! News. </description> <item> <title>Apple seeks to stop…</title> <link>http://news.yahoo.com/...</link> These three elements are <description>Apple Inc will seek a...</description> <pubDate>Mon, 27 Aug 2012 14:40:49</pubDate> required, but may appear in <source url="http://www.reuters.com">Reuters</source> any order. </item> ... </channel> </rss> 7 January 2019 OSU CSE 7
Example RSS Feed There can be zero or more <rss version="2.0"> <channel> item elements within <title>Yahoo! News</title> channel ; each has at least a <link>http://news.yahoo.com</link> title or description <description>The latest news and headlines from Yahoo! News. </description> element within it, but these <item> may appear in any order. <title>Apple seeks to stop…</title> <link>http://news.yahoo.com/...</link> <description>Apple Inc will seek a...</description> <pubDate>Mon, 27 Aug 2012 14:40:49</pubDate> <source url="http://www.reuters.com">Reuters</source> </item> ... </channel> </rss> 7 January 2019 OSU CSE 8
Example XMLTree Created <rss> <rss> version → 2.0 No order guaranteed <channel> <channel> among children . . . No order guaranteed <title> <title> <link> <link> <link> <description> <description> <item> <item> <item> <item> <item> among children The latest news and Yahoo! News http://news.yahoo.com headlines from Yahoo! News. <source> <source> <title> <title> <title> <link> <link> <description> <description> <pubDate> <pubDate> url → http://www.reuters.com Apple seeks to http:// Apple Inc will Mon, 27 Aug 2012 Reuters stop... news.yahoo.com/... seek a... 14:40:49 AT LEAST ONE REQUIRED, IF NOT REQUIRED REQUIRED REQUIRED PARENT PRESENT 7 January 2019 OSU CSE 9
Summary of XMLTree Features • Properties of the XMLTree from an RSS 2.0 feed: – The root node is an rss node with a version attribute whose value is "2.0" – There is one channel node as a child of the root – The channel node has certain required child nodes: one title , one link , and one description , in no particular order; it can also have zero or more item child nodes plus other optional children – No particular order is required among the children of an item node, but for each item node at least one of its children must be a title or description node 7 January 2019 OSU CSE 10
Resources • Wikipedia: RSS – http://en.wikipedia.org/wiki/RSS • Wikipedia: Web Feed – http://en.wikipedia.org/wiki/Web_feed • Wikipedia: Web Syndication – http://en.wikipedia.org/wiki/Web_syndication • RSS 2.0 Specification – http://www.rssboard.org/rss-specification 7 January 2019 OSU CSE 11
Recommend
More recommend