Easy, readable and fast text based format for Rev?
David Bovill
david at openpartnership.net
Tue Jun 12 10:54:27 EDT 2007
Based on the simple but fast philosophy of JSON - I'm looking at defining a
text based format which is readable, non binary and as fast as possible for
Rev to parse. I want like JSON to throw away all those pesky XML tags.
Now I can't remember the details but JSON and YAML I think use a simple
"name [delim] value" type notation - but keeping things completely flat (no
nesting). At the moment (see below) I am using a tab character for the
delimiter - I tried others but this seems to work for readability and
flexibility.
The notation i am thinking of therefore are simple lines like the following
(think of " [tab] " as just a single tab character):
name [tab] david
> height [tab] 6ft 2inches
> biography [tab] <sport>football</sports><interests>whatever</interests>
> notes [tab] flattened htmltext
> photo [tab] base64ofAnImage
>
I've been using this format for some things for a while - but thinking of
going with it for a large project. The idea is for XML to strip out any
white space - flatten it into one line - here are some of the (hoped for)
advantages:
- for htmltext that means just "replace CR" - setting it does not
require the CR so its fast.
- It also means you can split and combine the format into arrays for
fast processing.
- Sending the data around, as messages, over socket / the wire is fine
- As a text format I can use subversion to keep incremental backups
- I seem to be able to nest it indefinitley by using base64 encoding
of an entire chunk
- It is fast to convert to XML, JSON or other formats
I am not sure about using [tab] - but it just seems to work. Comments
appreciated.
More information about the use-livecode
mailing list