Table Data Notation

(BNotro Software Development.)
Format revision: 3.2

License: Creative Commons Attribution​​​​​​

SUMMARY

A fast, compact data format alternative to JSON and XML, suited to simple scenarios.

[Type] [Weight] [Cost]
Apple 0.1 $0.10
Pear .. ..
Banana 0.2 $0.30


AUTHOR

Andrew Kingdom, BNotro Software Development © 2017-2019

SOURCE CODE

INTRODUCTION

This document presents a simple, compact way to represent data tables in a format friendly to both humans and machines, suitable for both file storage and streaming.

The format is influenced by many existing formats that were reviewed in the process of defining it. 

The format has been used successfully in use in a number of real-world projects.

The aims are for compactness, robustness, readability, editability and simplicity of programming needed to parse it.

For simple data requirements this format is well suited as an alternative to the XML, JSON, tab delimited or comma delimited standards.

The format can also be used for marking or embedding data in text documents as a basic alternative to HTML or Markdown.

REQUIREMENTS and RECOMMENDATIONS

KNOWN WEAKNESSES

Currently there is no standard way to include delimiters within values (no delimiter escape mechanism)

This could be done grep (backslash…) and/or possibly html (ampersand character-name semicolon), but has not been a requirement yet. Suggestions welcome.

Deliberately there is no structural nesting, as per HTML: <i><b>value</b></i>

Deliberately there is no equivalent to HTML attributes, thus: <a href=url>

[EXAMPLES]
Here are a few examples to demonstrate the format.
[Creature]
Cat
Dog
Parrot
Fish
[Type] [Weight] [Cost]
Apple 0.1 $0.10
Banana 0.2 $0.30
Pear 0.15 $0.15
[Person] [Score] [Note]
Bob 10
Bob 40
Alice 90
Bob .. 90 score
Mary 40
Alice 83
[X] [Y] [Z] [A] [Note]
No result
4 2
2 4
No result
0
1 2 2
3 4
[Id] [space] [m2] [Note]
1 Cattleyard 50
2 .. 100 Cattleyard space too
3 .. 120 ditto
4 .. 70 ditto
5 Office 16
6 .. 12 Office space too
7 .. 10 ditto
[Table]
Meat
[Name] [Cost]
Beef $3.50
Ham $2.00
Turkey $2.50

SAMPLE PROGRAM CODE -------

Note: This is intended as one example of use. It is not optimised for speed or memory.

Language: Objective-C

File: data.txt
Make sure data.txt is included in the XCode project resource bundle:
Project Settings > Build Phases > Copy Files, (Resources), + (add file), uncheck 'copy only when installing'.

File: main.m

File: ReaderRow.h

File: ReaderTable.h

File (extract): Reader.h

File (extract): Reader.m

SAMPLE PROGRAM CODE -------

Note: This is intended as one example of use. It is not optimised for speed or memory.

Language: C# (C-Sharp)

File: ResourceRecord.cs

File: ResourceMap.cs

File: ResourceLoader.cs