An item in an RSS 2.0 feed looks like this:
<item>
<title>title</title>
<link>http://example.com/path/to/post</link>
<guid>http://example.com/path/to/post</guid>
<description>an rss2 item looks
like this:
<item>
<title>title</title>…</description>
</item>
title, link, guid and
description are all part of the spec. You can put in
other things if you like, as long as you put them in a namespace. Say, if
you want to categorise this item under the [[Topic Exchange]]'s Software channel, you could say
that this way:
<item
xmlns:ent="http://purl.org/NET/ENT/1.0/">
<title>title</title>
<link>http://example.com/path/to/post</link>
<guid>http://example.com/path/to/post</guid>
<description>an rss2 item looks
like this:
<item>
<title>title</title>…</description>
<ent:cloud ent:href=“http://topicexchange.com/topics”>
<ent:topic ent:id=“software”
ent:href=“http://topicexchange.com/t/software/“>software</ent:topic>
</ent:cloud>
</item>
ent:cloud and ent:topic, as well as the
attributes ent:href and ent:id are all defined
in the ENT spec.
If you wanted to make this item into a book review, still in the same
channel, you could say it like this.
<item
xmlns:ent="http://purl.org/NET/ENT/1.0/"
xmlns:rvw="http://purl.org/NET/RVW/0.1/">
<title>title</title>
<link>http://example.com/path/to/post</link>
<guid>http://example.com/path/to/post</guid>
<description>an rss2 item looks like this:
<item>
<title>title</title>...</description>
<ent:cloud ent:href="http://topicexchange.com/topics">
<ent:topic ent:id="software" ent:href="http://topicexchange.com/t/software/">software</ent:topic>
</ent:cloud>
<rvw:item>
<rvw:link>http://www.amazon.com/exec/obidos/ASIN/0156027321/</rvw:link>
<dc:identifier>ASIN:0156027321</dc:identifier>
<dc:type>Text</dc:type>
<dc:title>Life of Pi</dc:title>
<dc:creator>Yann Martel</dc:creator>
<dc:publisher>Harvest Books</dc:publisher>
<dc:date>2003-05</dc:date>
<ent:cloud ent:href="http://www.pmbrowser.info/rvw/">
<ent:topic ent:href="http://www.pmbrowser.info/rvw/types.xtm#book" ent:id="book">Book</ent:topic>
</ent:cloud>
<rvw:rating>
<rvw:minimum>0</rvw:minimum>
<rvw:maximum>10</rvw:maximum>
<rvw:value>7</rvw:value>
</rvw:rating>
</rvw:item>
</item>
All the rvw elements are defined in the RVW spec.
Now, if you want to post something like this to a weblog, what are
your options? Basically, you can use the metaWeblog API or make up
your own one. If you use the existing API, you will be compatible with
many existing blogging tools, and if you make up your own one, you won't.
In Python, the call to post a normal blog post looks like this:
import xmlrpclib
s = xmlrpclib.Server('http://127.0.0.1:5335/RPC2')
s.metaWeblog.newPost(BLOGID, LOGIN, PASSWORD, {
'title': TITLE,
'link': LINK,
'description': DESCRIPTION,
})
BLOGID, for Radio, is 'home'.
LOGIN and PASSWORD are the values you
configure here.
TITLE, LINK and DESCRIPTION
are the values that show in the title, link
and description elements in the resulting RSS.
If you want to include the ENT classification, it gets a bit
trickier. I think this is how it should work:
s.metaWeblog.newPost(BLOGID, LOGIN, PASSWORD, {
'title': TITLE,
'link': LINK,
'description': DESCRIPTION,
'http://purl.org/NET/ENT/1.0/':
{
'cloud':
{
'href':
"http://www.pmbrowser.info/rvw/",
'_value':
{
'topic':
{
'href': "http://www.pmbrowser.info/rvw/types.xtm#book",
'id':
"book",
'_value':
"Book",
},
},
},
},
})
I've never seen any code using this, but there are hooks in
Radio (see radio.weblog.metaWeblog.* and weblogData.callbacks.*) for plugins to
handle extra values, so it's likely that someone is using it somewhere.
The spec isn't clear as to whether namespaces have to be re-specified for
attributes (e.g. the ent:href under the
ent:cloud) or sub-elements (e.g. the ent:topic
under the ent:cloud), so this looks a little weird.
Does anybody know of any real-life examples of this sort of thing?
I'd be very interested to hear from you, as I'm not at all sure if I got the
above example correct.