RSS Data Publication
Sign Up Now!


Your RSS Feeds Include Custom Data

Once you add custom fields to a log, the data from those fields is included automatically in your RSS data feeds using a custom namespace.

Custom RSS Namespace

A custom namespace has been defined to share your data. It is specified in RDDL here and in XSD here.

Explanation



It's added to RSS with a namespace. That namspace is noted in the RSS feed with the following line:
<rss xmlns:entrydata="http://www.reger.com/about/specs/entrydata.rddl" version="2.0">


And that RDDL file points to a schema file:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="field">
        <xsd:complexType>
        <xsd:sequence>
                <xsd:element name="fieldname" type="xsd:string"/>
                <xsd:element name="fieldid" type="xsd:integer"/>
                <xsd:element name="data" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="name" type="xsd:string"/>
                            <xsd:element name="value" type="xsd:integer"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>


Inside of RSS it fits into an Item tag:

<rss version="2.0">
<channel>
<title>joereger.com</title>
<link>http://www.joereger.com/</link>
<description>A web log called http://www.joereger.com/</description>
<generator>
Reger.com datablogging Server Technology
</generator>
<item>
   <title>78 Mile Ride, Fast Ending</title>
   <link>
   http://www.joereger.com/entry-logid2-eventid3820-78-Mile-Ride-Fast-Ending.log
   </link>
   <description>
   Wow, that was a great ride.
   </description>
   <category>Triathlon</category>
   <pubDate>Tue, 12 Apr 2005 04:27:00 GMT</pubDate>
   <author>Joe Reger, Jr.</author>
   <comments>
   http://www.joereger.com/entry-logid2-eventid3820-78-Mile-Ride-Fast-Ending.log
   </comments>
   <guid>
   http://www.joereger.com/entry-logid2-eventid3820-78-Mile-Ride-Fast-Ending.log
   </guid>
   <entrydata:field>
      <entrydata:fieldname>Run Distance</entrydata:fieldname>
      <entrydata:fieldid>100</entrydata:fieldid>
         <entrydata:data>
            <entrydata:name><entrydata:name>
           <entrydata:value>8.1</entrydata:value>
         </entrydata:data>
   </entrydata:field>
   <entrydata:field>
       <entrydata:fieldname>Swim Distance</entrydata:fieldname>
       <entrydata:fieldid>107</entrydata:fieldid>
       <entrydata:data>
           <entrydata:name><entrydata:name>
           <entrydata:value>2.4</entrydata:value>
       </entrydata:data>
   </entrydata:field>
</item>
</channel>
</rss>


You see all of the normal stuff for an RSS feed... title, description, generator. Then in the item tag you see all of the normal stuff again. It gets to the data when you see the first entrydata:field tag.

So let's dissect this a bit, shall we?

You can have as many entrydata:field tags as you want. A field is a generalization of something that you would enter onto a form. It could be a dropdown or a textbox. But it could also be multiple check boxes or something completely different. Keep this in mind for when we get to the data part. For now, think of the entrydata:field simply.

Each entrydata:field has an entrydata:fieldname. This is the user-friendly name. In the example it's "Run Distance" and "Swim Distance". The name itself is largely for display on the consuming system. It also makes the feed much simpler to debug/develop/understand.

Each entrydata:field also has an entrydata:fieldid. This is a machine-friendly unique id. It can be numbers, as in the example's "100" and "107". Or it can be alphanumeric... something like "kjh798yoihiu". Or it could just be a copy of the fieldname "Run Distance". In our case the fieldid corresponds to a database key.

We decided to separate the user-friendly name from the machine-friendly name so that the user could change the name without affecting the way that machines were using the data. Imagine having thousands of readers, each with datablogging tools to consume your data in different ways. If they're keying off of your field name and you change it, all of their configuration is out the window. They'll be pissed. So we keep the fieldid constant.

At this point the xml has described the field a bit. Now it's got to communicate the data. We thought long and hard about really fancy and complex schemas for communicating the data, but eventually settled on the simpler name/value pair metaphor. It's the baseline for http forms and works for most of what we wanted to do.

Each entrydata:field can have many entrydata:data. And each entrydata:data has one entrydata:name and one entrydata:value.

For example:

<entrydata:field>
       <entrydata:fieldname>Swim Distance</entrydata:fieldname>
       <entrydata:fieldid>107</entrydata:fieldid>
       <entrydata:data>
           <entrydata:name><entrydata:name>
           <entrydata:value>2.4</entrydata:value>
       </entrydata:data>
   </entrydata:field>


This example tells you that the Swim Distance for the item (blog entry) it's attached to is 2.4. Note that we leave an empty name. In many cases we don't need to name the data. It's a simple data point. In other cases we need to name it, so we do.

In this way we can describe some fairly complex data and append it to RSS entries. We're open for ideas on how to do it better, so please don't hesitate to contact us.

Thanks.

More on datablogging: