TSML(5) FreeBSD File Formats Manual TSML(5)
NAME
Tree-Structure Markup Language -- A simple replacement for XML and SML.
DESCRIPTION
TSML describes tree-structured documents. No means are provided for
describing which trees are valid expressions for any particular applica-
tion of the language. No adjunct language exists for describing trans-
formations of one tree into another. There is no versioning of TSML.
This document describes the one-and-only version of TSML intended to ever
exist. If you create a format derived from TSML, please call it some-
thing else. The TSML format is hereby placed into the public domain.
TSML documents consist of two types of lexical components, tags and data.
Tags are either open or close tags. Data is everything not a tag. The
structural components of TSML documents are called elements. Each ele-
ment is described by one open tag and one identically-named, or anony-
mous, close tag, occuring later in document than the open tag. Elements
may contain a mixture of data and other elements to form tree-structure.
Note that elements must exist completely inside other elements. It is an
error of construction for any element's open tag to be contained inside a
different direct parent element than the direct parent element of the
open tag's corresponding close tag.
Open tags have the form:
[<name>[
Open tags begin and end with a single byte of value 91, which when inter-
preted in the UTF-8 character encoding, represents the opening square
bracket. The string of bytes between the brackets is the name of the
element. The name may be any sequence of byte values, excluding zero, in
which 91, 92, and 93 do not appear, which is less than 256 bytes in
length. 91, 92, and 93, are the UTF-8 encodings for the characters [, \,
and ], respectively.
Close tags have the form:
]<name>]
Close tags are delimited by single byte values of 93, representing the
closing square bracket. The name component of close tags is optional,
and if present, must be the exact same sequence of byte values of the
name of the corresponding open tag for the element being closed. Named
close tags help human beings recognize the shape of an element, if its
open and close tags are placed far apart in a document, or if its close
tag is adjacent to other close tags.
A TSML document has a single top-level element named TSML, which contains
the rest of the document. Elements may be empty. The simplest TSML doc-
ument therefore, is:
[TSML[]]
Data is any sequence of byte values, excluding zero, where any occurrence
of the values 91, 92, and 93 are preceded by a byte of value 92. In
other words, to insert [, \, or ] into data, these characters must be
escaped with a backslash. The two-byte sequences formed by escaping are
called escape-sequences. Although it is not necessary, other characters
may be similarly escaped by preceding them with a backslash. These pairs
are also considered escape-sequences. A TSML parser must remove the
escaping backslash from all escape-sequences before returning data to
calling applications.
Element names, and data after escape-processing, are opaque byte arrays
to a TSML parser. A TSML parser must not modify TSML element data before
returning it to an application in any way beyond escape-processing.
Activities such as normalization of line terminators to a standard form,
collapsing of whitespace, or normalization of equivalent multibyte char-
acters to a standard from, are expressly forbidden for TSML parsers to
perform. All modification of escape-processed document data must be
accomplished at the application level.
There is no mechanism to embed comments into TSML documents. If comments
are desired, it is recommended that the user employ
[comment[Comment text goes here.]]
elements in his or her TSML documents, and construct his or her applica-
tions to ignore those elements.
EXAMPLES
Here is an sample document expressed in TSML, representing a TSML equiva-
lent of an RSS feed. Note the use of whitespace in element names, which
is not possible in XML.
[TSML[
[Document Type[Syndicated News Feed]]
[Document Content Type[text/plain; charset=utf-8]]
[Document Data[
[Source[
[Title[Invasion News Now!]]
[Link[http://www.invasion-news.ca]]
[Description[Your one-stop source for the latest and greatest on
the destruction of our planet!]]
]]
[Item[
[Title[Hullabaloo Over Alien Invasion]]
[Link[http://www.invasion-news.ca/hullabaloo]]
[Description[Well, those pesky aliens just won't leave. It seems
they want our pretty blue planet for themselves...]]
]]
[Item[
[Title[Aliens Eat Toronto!]]
[Link[http://www.invasion-news.ca/toronto]]
[Description[Golly. Toronto is gone. This reporter never thought
he would see the day when the CN tower would be used as a toothpick for a
giant green extra-terrestrial creature...]]
]]
]Document Data]
]TSML]
AUTHORS
James Bailie <jimmy@mammothcheese.ca>
http://www.mammothcheese.ca
Feb 18, 2009