Data may be stored in various fashions for various reasons, such as efficiency or legacy. Furthermore, such data may have to be displayed or presented in various formats or output media.
To handle this problem, I designed an object model for handling heterogeneous data, and a templating system to traverse such data and display it.
Heterogeneous data is handled by:
Together, this suffices to construct virtually any structured object, and can hence accommodate virtually any data semantics desired or imposed.
In parallel, I developed a templating system to traverse a structured object and display desired attributes. This, in effect, defines a restricted language with:
I wrote a lexer, parser and evaluator for this language. A template for the Web looks like normal HTML with special nets tags (such as <nets.render ...> and </nets.either>) embedded in it. This example template illustrates value look-up, looping, conditionals and recursive paremetrised template invocation.
Parsing a typical template takes about 20ms. The parsed template may be cached. Evaluating it to generate output takes about 10ms, plus whatever time the underlying storage systems take to supply the requisite data.
Rujith de Silva 1997-05-13