Skip to content
This repository has been archived by the owner on Feb 14, 2018. It is now read-only.

Story XML

GerryG edited this page Mar 1, 2012 · 3 revisions

Example story XML, original JSON from file data/pages/welcome-visitors

<story title="Welcome Visitors"
    synopsys="The first federated wiki page written and often first page viewed.">
  <paragraph id="7b56f22a4b9ee974">
      Welcome to the federated wiki. This page was first drafted 
      Sunday, June 26th, 2011, at [[indie-web-camp]]. You are welcome 
      copy this page to any server you own and revise its welcoming
      message as you see fit. You can assume this has happened many 
      times already."
  </paragraph>
  <image id="8d8a6cf94b72e848"
         width="300px",
         height="200px",
         caption="Ward's Lighted Electric Bike at [http://www.shift2bikes.org/cal/viewpp2011.php#24-2144 Pedalpalooza]"
         url="/lit-and-loud.jpg"/>
  <trail><ti url="http://fw.indiewebcamp"/>
         <ti url=http://c2.com/~ward/fw"/>
  </trail>
  <journal>
       <edit id="15411293042b2735">"the paragraph now says this"</edit>
  <journal/>
<story/>

The welcome-visitors page above was the first ever written. It would be poetic if all future versions of this wiki can read and render this simplest of pages. (Kinda like browsers supporting HTTP 0.9)

This is adapted from the original "Story JSON" page (how do I make a wiki link in Markdown?)

The idea of this page is to propose an (optional) alternative representation for Federated Stories, and the idea is that there would be an exact mapping between the JSON representation which is definitive and this one.

Advantages

XML and DOM are really the native object representation in browsers, and Javascript is often manipulating and replacing DOM elements. This can be done more directly than to/from JSON.

Closer connection to HTML encoding standards.

Can remap and filter any styles easily in XSLT.

JSON Advantages

Cleaner mapping to hash/array standard representations of many current languages including javascript.

Native to many javascript libraries including JQuery and other similar packages.

The most compelling advantage is related to the above, that it is more appropriate for programming APIs because of this simple structure and mapping onto language objects. Therefore, I think we might conclude that JSON is the native representation, but there will be significant interoperability advantages in supporting both in servers. This means that SFW wouldn't use DOM objects much in the API specifications, but you might use it in clients, and some clients may even want to rely exclusively on XML "over the wire".

Clone this wiki locally