HOME   PRODUCTS   PARTNERS   STORE   COMPANY     

Introduction

Snaml is an XML generator. Snaml for Tcl is an integration of scripting language Tcl and Snaml for XML applications. (Snaml means Snaky Markup Language. It represents an ancient snake. When Snaml's head is attacked, its tail will come to help; when its tail is attacked, its head will be back to help; when its body is attacked, both head and tail will defense.)

HyperText Markup Language (HTML) is a description language for web document. Berent. Lee innovated the HTML from SGML. Netscape first implemented a widely used HTML browser. Today HTML is a defacto standard for web document. The new Extensible Markup Language (XML) of W3 standard extended HTML to allow authors define new tags and attributes. XHTML 1.0 is an XML application for HTML 4.0. XHTML is designed to be the presentation standard for both web and mobile document. As description languages, XHTML and XML are very suitable to represent embedded documents. However, since these languages are lack of variables, it is difficult to use them as programming languages. Therefore, the XHTML document may be not well on modularity and reusability.

Tcl is a Tool Command Language innovated by Dr. Jhon Ousterhout in the late 1980s. It is a typeless scripting language with simple and elegant syntax. It originated from unix shell command language. Because of its command, substitution and grouping syntax, Tcl is very powerful and flexible for string processing and glue components. However, because of the lack of block commands, Tcl is difficult to express the embedded documents.

Snaml for Tcl added the block command and inline command to integrate the Tcl with XHTML and other XML standards. Snaml code could be an XHTML generator. It can generate an XHTML web page and document. Snaml programs make a web site more maintainable, modifiable, and reusable. Anther benefit of website builded by Snaml is higher level consistence. In addition, Snaml is much easier to connect to a database and present database content. Snaml is well done on the Presentation Logic on Web Applications.

Following simple Snaml for Tcl program shows a picture with the title 'Hello' and output to hello.html.

# use xhtml package

package require XHTML

# output to a file. If there is no output or its first parameter is null,
# the default output is to stdout.

output hello.html

# xml header and doctype definition

__pi "xml version='1.0' encoding='UTF-8'"
__doctype	 "html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 
  'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'"

# xhtml header. quote command render the string.

_html "xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'"
_head
  _title
    quote Hello
  title_
head_

# xhtml body

_body
  __img "src='hello.gif' alt='hello'"
  quote "Hello World!"
body_
html_