rNews 1: Implementation Guide Introduction
In our introduction to rNews, we provided an exhaustive rundown of the entire rNews standard. We presented the data model, enumerated the classes and used this knowledge to completely model a sample article. In this section, we're going to take this model, dramatically simplify it, and show you how to embed the result in HTML using both HTML5 Microdata and RDFa. When you're done reading this, you'll know everything you need to implement rNews on your site.
In our introduction we wanted to show you everything that rNews could do, so we used a sample article of great complexity. In this section we're more interested in the nuts and bolts of implementing rNews, so we're going to simplify our example and focus on the essential properties.
Below is the simplified article:
Behind the scenes, this article is expressed using the following HTML. We've removed styling information and truncated long strings for clarity.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head></head>
<body>
<div>
<div>
<div>Allies Are Split...</div>
<div>NATO Takes Command</div>
<div>
<img src="img/libya_sample_reuters.jpg"/>
<div>Credit: Goran Tomasevic/Reuters</div>
<div>Rebel fighters take...</div>
</div>
<div>By STEVEN LEE MYERS</div>
<div>WASHINGTON | March 24, 2011</div>
<div>
<p>Having largely succeeded...</p>
</div>
<div>
<p><a href="http://www.nytimes.com/content/help/rights/copyright/copyright-notice.html">
© Copyright 2011
</a><span>The New York Times Company</span></p>
<p><a href="http://www.nytimes.com/ref/membercenter/help/agree.html">
Disclaimer
</a></p>
</div>
</div>
<div>
<div>
<div>Section</div>
<div>World</div>
</div>
<div>Tags</div>
<div>
<div>
<div>People</div>
<div>Qaddafi, Muammar el-</div>
</div>
</div>
<div>
<div>Discussion (3)</div>
<div>
<div>So the question is..."</div>
<div>
<a href="http://timespeople.nytimes.com/view/user/27242827/activities.html">Chuck</a></div>
<div>March 25th, 2011 8:27 am</div>
</div>
</div>
</div>
</div>
</body>
</html>
Now that we have this HTML article, we need some structured data to embed . Below, we've simplified the the model we produced in our introduction to rNews. We'll be working with this simplified model for the rest of this tutorial.
<NewsArticle>
<alternativeHeadline>NATO Takes Command</alternativeHeadline>
<articleBody>Having largely succeeded in stopping a rout of...</articleBody>
<articleSection>World</articleSection>
<copyrightNotice>http://www.nytimes.com/content/help/rights/copyright/copyright-notice.html</copyrightNotice>
<copyrightYear>2011</copyrightYear>
<dateCreated>2011-03-24</dateCreated>
<dateline>WASHINGTON</dateline>
<description>The questions about the command mirrored the strategic...</description>
<headline>Allies Are Split on Goal and Exit Strategy in Libya</headline>
<inLanguage>en-US</inLanguage>
<itemtype>http://schema.org/NewsArticle</itemtype>
<thumbnailUrl>http://graphics8.nytimes.com/images/common/icons/t_wb_75.gif</thumbnailUrl>
<usageTerms>http://www.nytimes.com/ref/membercenter/help/agree.html</usageTerms>
<about>
<Person>
<id>http://data.nytimes.com/91178019641520997503</id>
<itemtype>http://schema.org/Person</itemtype>
<name>Qaddafi, Muammar el-</name>
</Person>
</about>
<associatedMedia>
<ImageObject>
<itemtype>http://schema.org/ImageObject</itemtype>
<id>http://graphics8.nytimes.com/images/2011/03/25/world/africa/Policy/Policy-articleLarge.jpg</id>
<description>Rebel fighters take cover during a shelling near Ajdabiyah, Libya on Thursday.</description>
<copyrightHolder sourceOrganization provider>
<Organization>
<id>http://www.reuters.com</id>
<itemtype>http://schema.org/Organization</itemtype>
<name>Reuters</name>
</Organization>
</copyrightHolder sourceOrganization provider>
<creator>
<Person>
<id>http://blogs.reuters.com/goran-tomasevic/</id>
<itemtype>http://schema.org/Person</itemtype>
<name>Goran Tomasevic</name>
</Person>
</creator>
</ImageObject>
</associatedMedia>
<comment>
<UserComment>
<commentText>So the question is: Why is Secretary of Defense Hillary Clinton speaking as the Defense Secretary...</commentText>
<commentTime>2011-03-2011T08:27Z</commentTime>
<id>http://community.nytimes.com/comments/www.nytimes.com/2011/03/25/world/africa/25policy.html?permid=1#comment1</id>
<itemtype>http://schema.org/UserComment</itemtype>
<creator>
<Person>
<id>http://timespeople.nytimes.com/view/user/27242827/activities.html</id>
<itemtype>http://schema.org/Person</itemtype>
<name>Chuck</name>
</Person>
</creator>
</UserComment>
</comment>
<copyrightHolder provider sourceOrganization>
<Organization>
<id>http://www.nytimes.com</id>
<itemtype>http://schema.org/Organization</itemtype>
<name>The New York Times Company</name>
<tickerSymbol>NYSE NYT</tickerSymbol>
</Organization>
</copyrightHolder provider sourceOrganization>
<createdBy>
<Person>
<id>http://topics.nytimes.com/topics/reference/timestopics/people/m/steven_lee_myers/</id>
<itemtype>http://schema.org/Person</itemtype>
<name>STEVEN LEE MYERS</name>
</Person>
</createdBy>
</NewsArticle>
We've got an HTML document, and we've got a model of the data in that document. It's time to do some embedding.
rNews provides two mechanisms for embedding data into HTML documents: HTML5 Microdata and RDFa. The HTML 5 Microdata Implementation is further divided into two variants: a version that relies solely on the IPTC namespace and a schema.org-compatible version. It is left to implementing organizations to determine which Microdata implementation best suits their particular business needs.
Below are links to the three separate implementation guides.
- HTML 5 Microdata
- RDFa rNews Implementation Guide
Want to comment on rNews: we invite you to post your comment to the rNews Forum.