talideon.com

Never mind the quality, just feel the width!

October 25, 2007 at 10:24AM A RELAX NG compact schema for RSD

I was feeling a bit bored last night and decided to write a schema for RSD in RELAX NG compact syntax. RSD is about five years old at this point, and nobody ever seems to have got around to writing one, so this might help somebody who wanted to make sure they’re producing valid RSD files:

default namespace = "http://archipelago.phrasewise.com/rsd"

# To make it explicit that these element do *not* contain any encoded HTML
# markup.
plainText = text

start = element rsd {
  attribute version { "1.0" },
  element service {
    element engineName { plainText },
    element engineLink { xsd:anyURI },
    element homePageLink { xsd:anyURI },
    element apis {
      element api {
        attribute name { text },
        attribute preferred { "true" | "false" },
        attribute apiLink { xsd:anyURI },
        attribute blogID { text },
        element settings {
          element docs { xsd:anyURI }?,
          element notes { plainText }?,
          element setting {
            attribute name { text },
            text
          }*
        }?
      }+
    }
  }
}

I’m not using xsd:boolean for the preferred attribute because it accepts 0 or false for false and 1 or true for true, whereas the spec states that it should only accept false and true.

Where this differs from the RSD spec, the spec is canonical, not this schema. However, this schema adds some rigour that the spec lacks, so where the spec is ambiguous, you can assume the schema above is correct.

Technorati Search Technorati Search Irish Bloggers

Comments

No comments.

Post a comment

All form information is optional, but it’s a good idea to fill in your name and email address if you want me to take your comment seriously.

Spammers, don’t bother posting crap down here. The site is set up so that legitimate search engines (Google, for instance) won’t index pages with comments on them. Posting crud here only means you’re wasting my time and patience. Shoo!

Real names, please. Please include!
Won’t be displayed. Please include!
Displayed, if present.