Making XRIs With XRDS


User-friendly view of my
XRDS file
User-friendly view of my XRDS file
(click to enlarge)

Yesterday I posted a piece on XRIs and i-names at Between the Lines. Now that 2idi, my i-name registrar, is supporting forwarding, I've configured several XRIs that resolve to specific places on the 'Net including my blog, RSS feed, and even me at Skype.

I mentioned William Tan's FoXRI extension to Firefox that allows native resolution of XRIs (e.g. xri://=windley/(+blog)) instead of using an XRI proxy. Playing with that tool, I realized that the XRDS document for =windley was pretty skimpy. William informed me that 2idi has a new experimental feature that allows you to customize your XRDS document and create XRIs of all shapes and sizes.

We usually create URIs indirectly, by creating a file on our Web server, for example. With XRIs, at least now, you create them explicitly by editing the XRDS document. That will probably change at some point as more ways for developers to explore and use XRIs become available.

Before you get too far, it's a good thing to read the official specification on XRI resolution. Like most specs its dry and boring, but there's good reference material in there.

I wanted to create this XRI:

xri://=windley/blog/feed

I have my feed XRI in standard XRI semantics, but I also wanted to specialize my feed from my blog so that I could have feeds from other places too. To do this, I added the following endpoint specification at 2idi:

<xrd:Service>

    <xrd:Type xrd:match='null'/>

    <xrd:MediaType xrd:match='content' xrd:select='false'>
    application/atom+xml
    </xrd:MediaType>

    <xrd:MediaType xrd:match='default' xrd:select='false'/>

    <xrd:Path xrd:select='true'>
    blog/feed
    </xrd:Path>

    <xrd:Path xrd:match='default'/>

    <xrd:URI xrd:priority='1' xrd:append='none'>
      http://www.windley.com/atom.xml
    </xrd:URI>

</xrd:Service>

William Tan was good enough to give me some tutoring on all this. Be careful if you mess with your service endpoints, you could really mess things up. There's no undo feature in 2idi's implementation or even a reset. You may want to use a query like this (substituting your own i-name) to save your XRDS doc before you start playing around.

http://xri.net/=windley?_xrd_r=application/xrd%2Bxml;sep=false

While this is fun, it's not very natural. With DNS (and this URLs), you can run BIND for your own domain. The TLD just delegates the lookup to the authoritative name server. Right now, there's no way to take control or serving your own XRDS document (at least not that I know). Consequently, I can't easily build software that controls my XRIs. If 2idi would put a RESTful API on the service endpoint application, that would be a start.