March 31, 2003

XML Schema for RSS 2.0

UPDATE (Sept-2007): This RSS 2.0 Schema project is now hosted as an open-source project on the CodePlex site (
All future development and releases are now occurring there -- see the RSS 2.0 Schema discussion list and RSS 2.0 Schema issue tracker for more details.

I looked around for an XML Schema definition for RSS 2.0, so I could post some examples and ideas on extending the core specification based on some of the discussions over the weekend through Don Box's and Sam Ruby's weblogs. I was somewhat surprised (or maybe not - see below) that Google could not find one, so after a bit of noodling this morning, I present an *experimental* version of an XML Schema for RSS 2.0 for community discussion and feedback.
Update: 15-April-2003 - Here's the most recent version:

There are still a few problems with this schema (outlined below), but in the principle of "release early, release often" I want to show the work-in-progress at this stage to get some extra eye-balls on the problems. I *believe* this schema represents an accurate translation of the RSS 2.0 spec, but don't go building a nuclear power station based on the file - in other words, the usual legal disclaimers apply: "No warrenties, blah, blah, blah..."

Outstanding problems:
(Update: I changed my list of questions to use numbers, for easier reference.)

  1. I need to find a standard schema typedef for an "e-mail address" - any pointers?
    In the meantime, I have used xs:string.
    Update: Gudge says I need a regexp. - Changed in Revision 2
  2. I need to find a standard schema typedef for an "RFC-822 Date" - any pointers?
    In the meantime, I have used xs:string rather than xs:dataTime to avoid spurious validation errors.
    Update: Gudge says I need a regexp.
  3. I need to find a standard schema typedef for "ISO language codes" - any pointers?
    In the meantime, I have used xs:string.
    Update: Gudge says xs:language should do the trick. - Changed in Revision 2.
  4. I need to find a standard schema typedef for "MIME media type" - any pointers?
    In the meantime, I have used xs:string, but {}:MediaType should be directly re-usable I think.
    Update: Gudge says I need a regexp.
  5. I haven't included the Dublin Core fields that are an intrinsic part of most RSS 2.0 feeds. They just look like opaque extensions to this schema, which is the intend because I want to move on to look at "whole document versioning" next where the idea of "mandatory extensions" comes into play.
  6. I can't work out how to codify the constraint on an item "at least one of title or description must be present". The usual mechanisms of key and unique don't seem to fit well here. Maybe I just wrote too much schema this morning, and my brain is now pickled??
    Update: Gudge says it can't be done with Schema! That's a relief! Sort of.
  7. My schema defs for the two different usages for guid are I believe correct, but I can imagine it will cause a few tools some fun!
    Update: Gudge says I need to change it, so I will! - Fixed in Revision 2
  8. Is elementFormDefault="qualified" for no namespace (targetNamespace="") OK? Depending on how you look at it, all the core elements are implicitly qualified with no namespace in RSS 2.0 files. I don't think it matter, but let me know if tools will barf on this notion and I can change it.
    Update: Gudge says no! I'll change it. - Fixed in Revision 2
  9. Element ordering is a big problem! I placed the standard <any> extensibility points after the spec fields, but in reality namespace qualified extensions could appear anywhere I think. This is obviously the problem with using <sequence> rather than <all>, but I can't use <all> because I have a <choice> (for the two usages of the guid element) , and because the item sub-elements have maxOccurs greater than one. I can't figure out how to represent it even after reading Gudge's book, so it must be hard! Aaargh! Help me, Gudge! Hopefully, the Bat-Phone is ringing in Gudge Manor as we speak ;-)
    Update: After many calls on the bat-phone to Gudge Mannor, this is working in Revision 4

Having said that, my RSS 2.0 feed seems to validate OK against this curent version of the schema if I add a xsi:noNamespaceSchemaLocation declaration and move "extension" element on the channel to after the item entries, so I think it is on the right lines at least.
Update: Maybe it was a false positive?? Let's see shortly how the next rev looks.

All feedback welcome (including errors, omissions, and stylistic comments) - Just use the comment facility for this weblog entry.

Entry categories: RSS
Posted by Jorgen Thelin at March 31, 2003 11:51 AM - [PermaLink]
There wasn't anything useful here?: Posted by: joe on March 31, 2003 02:34 PM
The Bat-Phone in Gudge Manor does work, and I have now got a long-ish list of errors and suggestions to work my way through. It turns out that XML-Spy v4.4 which I used to write the Schema doc made some big goofs in a couple of places, so watch this space for an update... Posted by: Jorgen Thelin on March 31, 2003 02:38 PM
I'm not sure I understand the question, Joe, but without an XML Schema for RSS, there isn't any framework to slot the XHTML modules into as far as I can see. Posted by: Jorgen Thelin on March 31, 2003 02:42 PM
Why remove the targetNamespace and elementFormDefault="qualified". What im looking for in a schema is strong typing and for that you need the targetNamespace. There are some pretty "common" elements in RSS (title, description etc) and theese elements could clash with other elements when working with RSS in a given context. And what about version control? Posted by: Rene Loehde on April 3, 2003 03:28 PM
I wrote up some of my experiences and frustrations of producing this schema for RSS 2.0 in another posting. Posted by: Jorgen Thelin on April 20, 2003 11:09 PM
Great work! Posted by: Randy Charles Morin on June 16, 2003 10:00 PM
Jorgen, I need an XML schema to go along with my PSS standard in order to start developing some really interesting RSS/XML based applications. Are you supporting your XML Schema for RSS 2.0 going forward? If so, I'd like to reference it, or if you didn't mind, I could take it over and move it forward. Posted by: Randy Charles Morin on June 16, 2003 10:10 PM
Hi Randy, Yes, it certainly is my intention to maintain the RSS schemas and keep them up to date (RSS chaos permitting!). Just today I posted some minor revisions based on validation by the new Oxygen XML Editor, for example. Feel free to reference the most up to date version of the RSS schema at Do let me know of any problems you find too. Posted by: Jorgen Thelin on June 19, 2003 02:38 PM
Jorgen, I've got quite a few regex patterns for XSD's. Can you post a couple examples of what you want? I'll be happy to get them to you. Sean Posted by: Sean Gerety on June 19, 2003 04:38 PM
RSS-2_0.xsd In the definition of "title" and "description" you forgot define the type "xs:string". It makes any Problems. And i have any problems to use this XSD-file with Altova stylevision-designer. The designer expected global-elements to define global styles. I try to fix it. Posted by: Schwotzer on June 23, 2003 02:10 PM
Hi Andreas, I fixed the bugs in the schema you pointed out. Not sure what to do about the other problem you mention. Posted by: Jorgen Thelin on June 25, 2003 02:23 PM
Jorgen, I started using a web log that created a RSS news feed and as a new user to my XML editor, I was interested to find an XSD schema that would add insight to what the news feed is and what can be done with it. Thank you for all your hard work! -Jason Posted by: Jason Wiegand on July 17, 2003 01:56 PM
This is good stuff, and sorely needed. Nice work :) G. Posted by: Graeme Foster on July 26, 2003 09:27 AM
I put the regex for a URI here. Sorry about that. Sean Posted by: Sean Gerety on August 8, 2003 08:04 PM
I used your XSD in this creation. Still have some work todo. Posted by: Randy Charles Morin on October 1, 2003 08:55 PM