0xDECAFBAD

It's all spinning wheels and self-doubt until the first pot of coffee.

An example of an RSS 2.0 namespace versus RSS-Data usage

Okay, just for the sake of tinkering, I'm poking at embedding data from the Amazon Web Services into an RSS 2.0 feed. On one hand, I just shoehorned the Amazon XML schema into an RSS 2.0 namespace, and on the other, I tried transliterating the Amazon XML data into RSS-Data / XML-RPC serialized data structures.

To resolve my own love/hate of this RSS-Data idea, I'm planning to keep going from here and work up some simple Python scripts to produce and consume data along the lines of both examples, then to comment on the experience. (This is assuming I don't run out of round tuits.) Some things to note:

  • Your XML mojo is probably stronger than mine, so please feel free to correct me.
  • Although I created the RSS-Data example by hand, it would otherwise be completely produced and consumed by machine.
  • Since it's at the root of a few things I'm thinking, it's worth restating: RSS-Data is intended to be produced and consumed by machine, not by humans. This means that the XML data needs not look pretty or elegant to you, but to your machine.

So, on with the XML. First, I requested data from Amazon and got the following:

<?xml version="1.0" encoding="UTF-8"?>
<ProductInfo
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://xml.amazon.com/schemas3/dev-lite.xsd">
  <Details url="http://www.amazon.com/exec/obidos/ASIN/0439139597/0xdecafbad-20">
    <Asin>0439139597</Asin>
    <ProductName>Harry Potter and the Goblet of Fire (Book 4)</ProductName>
    <Catalog>Book</Catalog>
    <Authors>
      <Author>J. K. Rowling</Author>
      <Author>Mary GrandPr?</Author>
    </Authors>
    <ReleaseDate>08 July, 2000</ReleaseDate>
    <Manufacturer>Scholastic</Manufacturer>
    <ImageUrlSmall>http://images.amazon.com/images/P/0439139597.01.THUMBZZZ.jpg</ImageUrlSmall>
    <ImageUrlMedium>http://images.amazon.com/images/P/0439139597.01.MZZZZZZZ.jpg</ImageUrlMedium>
    <ImageUrlLarge>http://images.amazon.com/images/P/0439139597.01.LZZZZZZZ.jpg</ImageUrlLarge>
    <Availability>Usually ships within 24 hours</Availability>
    <ListPrice>$25.95</ListPrice>
    <OurPrice>$18.16</OurPrice>
    <UsedPrice>$3.97</UsedPrice>
  </Details>
</ProductInfo>

From this, I cooked up an example RSS feed with Amazon's XML schema shoehorned in as a namespace:

<rss version="2.0"
  xmlns="http://blogs.law.harvard.edu/tech/rss"
  xmlns:az="http://www.amazon.com/gp/aws/landing.html"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.amazon.com/gp/aws/landing.html
                      http://xml.amazon.com/schemas3/dev-lite.xsd">
  <channel>
    <title>Testing Amazon Namespace</title>   
    <item>
      <title>Harry Potter and the Goblet of Fire (Book 4)</title>
      <az:ProductInfo>
        <az:Details url="http://www.amazon.com/exec/obidos/ASIN/0439139597/0xdecafbad-20">
          <az:Asin>0439139597</az:Asin>
          <az:ProductName>Harry Potter and the Goblet of Fire (Book 4)</az:ProductName>
          <az:Catalog>Book</az:Catalog>
          <az:Authors>
            <az:Author>J. K. Rowling</az:Author>
            <az:Author>Mary GrandPr?</az:Author>
          </az:Authors>
          <az:ReleaseDate>08 July, 2000</az:ReleaseDate>
          <az:Manufacturer>Scholastic</az:Manufacturer>
          <az:ImageUrlSmall>http://images.amazon.com/images/P/0439139597.01.THUMBZZZ.jpg</az:ImageUrlSmall>
          <az:ImageUrlMedium>http://images.amazon.com/images/P/0439139597.01.MZZZZZZZ.jpg</az:ImageUrlMedium>
          <az:ImageUrlLarge>http://images.amazon.com/images/P/0439139597.01.LZZZZZZZ.jpg</az:ImageUrlLarge>
          <az:Availability>Usually ships within 24 hours</az:Availability>
          <az:ListPrice>$25.95</az:ListPrice>
          <az:OurPrice>$18.16</az:OurPrice>
          <az:UsedPrice>$3.97</az:UsedPrice>
        </az:Details>
      </az:ProductInfo>
    </item>   
  </channel>   
</rss>

Then, I transliterated things into what I understand of RSS-Data:

<rss version="2.0"
  xmlns="http://blogs.law.harvard.edu/tech/rss"
  xmlns:sdl="http://radio.weblogs.com/0113297/2003/10/01.html#a237">
  <channel>
    <title>Testing Amazon Namespace</title>   
    <item>   
      <title>A Sample Item</title>
      <sdl:data>
        <sdl:struct>
          <sdl:member>
            <sdl:name>url</sdl:name>
            <sdl:value>
              <sdl:string>http://www.amazon.com/exec/obidos/ASIN/0439139597/0xdecafbad-20</sdl:string>
            </sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>Asin</sdl:name>
            <sdl:value><sdl:string>0439139597</sdl:string></sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>ProductName</sdl:name>
            <sdl:value>
              <sdl:string>
                Harry Potter and the Goblet of Fire (Book 4)
              </sdl:string>
            </sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>Catalog</sdl:name>
            <sdl:value><sdl:string>Book</sdl:string></sdl:value>
          </sdl:member>          
          <sdl:member>
            <sdl:name>Authors</sdl:name>
            <sdl:value>
              <sdl:array>
                <sdl:data>
                  <sdl:value>J. K. Rowling</sdl:value>
                  <sdl:value>Mary GrandPr</sdl:value>
                </sdl:data>
              </sdl:array>
            </sdl:value>            
          </sdl:member>
          <sdl:member>
            <sdl:name>ReleaseDate</sdl:name>
            <sdl:value>
              <sdl:dateTime.iso8601>2000-07-08T00:00:00</sdl:dateTime.iso8601>
            </sdl:value>
          </sdl:member>          
          <sdl:member>
            <sdl:name>Manufacturer</sdl:name>
            <sdl:value><sdl:string>Scholastic</sdl:string></sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>ImageUrlSmall</sdl:name>
            <sdl:value>
              <sdl:string>http://images.amazon.com/images/P/0439139597.01.THUMBZZZ.jpg</sdl:string>
            </sdl:value>
          </sdl:member>          
          <sdl:member>
            <sdl:name>ImageUrlMedium</sdl:name>
            <sdl:value>
              <sdl:string>http://images.amazon.com/images/P/0439139597.01.MZZZZZZZ.jpg</sdl:string>
            </sdl:value>
          </sdl:member>          
          <sdl:member>
            <sdl:name>ImageUrlLarge</sdl:name>
            <sdl:value>
              <sdl:string>http://images.amazon.com/images/P/0439139597.01.LZZZZZZZ.jpg</sdl:string>
            </sdl:value>
          </sdl:member>          
          <sdl:member>
            <sdl:name>Availability</sdl:name>
            <sdl:value><sdl:string>Usually ships within 24 hours</sdl:string></sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>ListPrice</sdl:name>
            <sdl:value><sdl:string>$25.95</sdl:string></sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>OurPrice</sdl:name>
            <sdl:value><sdl:string>$18.16</sdl:string></sdl:value>
          </sdl:member>
          <sdl:member>
            <sdl:name>UsedPrice</sdl:name>
            <sdl:value><sdl:string>$3.97</sdl:string></sdl:value>
          </sdl:member>
        </sdl:struct>
      </sdl:data>
    </item>   
  </channel>   
</rss>

shortname=rss_data_versus_namespace

Archived Comments

  • Hehe... :) Good work. This demonstration should put this RSS-Data nonsense to rest. Nothing like a good example...
  • Thanks for building a good example comparison--very useful and helpful to the discussion
  • Here's code to parse the RSS-Data version: http://www.myelin.co.nz/post/2003/10/3/#200310031
  • Heh - nothing like actually seeing something. And surely if you use a schema version of RSS you would get the extra information about the metadata without having to put it inline with the feed itself?
  • And here's code to parse the namespace version: http://www.myelin.co.nz/post/2003/10/3/#200310032
  • I've done a first-shot at this in RDF/XML : http://dannyayers.com/archives/001908.html Compare and contrast with the RSS-Data version (especially in terms of readibility, simplicity etc ;-)
  • Just started looking into the RSS-Data format and lightly read over your samples. What I noticed first off was there was no currency definition. I believe this would be a critical component of international business. mxt