The Poor Man's XLink-Like Thing

by Kofi Sarfo 23. September 2009 01:18

The following StackOverflow post is interesting not so much because of the text but how it's rendered.

Loading Stack Overflow post...

We begin with a <div> tag which contains an expected id attribute format and using a jQuery regular expression we're able to match all div elements with an "id" attribute beginning "RSSContent".


<div id="Container">
<div id="RSSBlock">
<div id="RSSContent200909222115"
runat="server"
title="http://stackoverflow.com/feeds/question/477962" />
</div>
</div>

The "title" attribute for each element matched is used in an HTTP post of content-type application/json to a web service which acts as a proxy to overcome cross-scripting JavaScript constraints. This returns the post above which I found useful recently.

It's not an elegant solution. I've hacked the div element, using the "title" attribute to hold the URL and the directory structure isn't great either. The web service creates a user control which appears to work only in the root directory and the web application project requires a reference to an identical control in another project. The things we do for code compilation!

The end result is that rather than cut & paste, which would have been far easier we're using using an external resource to supply text so that if the RSS feed item was to change, for example, then we'd still display the most current version.

An XLink implementation, this is not. It's just an example of how I thought the web might work sometime soon after 2001... What we're missing here, conceptually at least, is meta to describe the relationship between this post and the one referenced. Well, in this case the meta is only human-readable and quite incomplete.

Tags: ,

JSON | Toys

Comments are closed

Kiva Loans

  • Phalla's Group

    Phalla's Group

    Farming

    Requested loan: $675

    Amount raised: $0

    Battambang province, Moung Russey district, Cambodia

    to buy fertilizer and rice seeds for her farmland.

    Loan Now »

  • Nyoka

    Nyoka

    Clothing Sales

    Requested loan: $1250

    Amount raised: $0

    yei, South Sudan

    to purchase more clothing.

    Loan Now »

  • Pov's Group

    Pov's Group

    Fruits & Vegetables

    Requested loan: $325

    Amount raised: $0

    Battambang province, Sangke district, Cambodia

    to buy more vegetables to resale.

    Loan Now »

To see more entrepreneurs »

Make a loan to an entrepreneur across the globe for as little as $25. Kiva is the world's first online lending platform connecting online lenders to entrepreneurs across the globe.