Thomas Perst and Helmut Seidl. A Type-safe Macro System for XML. Extreme Markup Languages, Montréal, Quebec, Canada, August 2002.

XML is originally designed for the use in document processing. Every classical document processing system supports a mechanism which is called macro. In general, a macro is a named collection of actions. These actions are executed whenever the name of the macro appears in a document instance. We describe a very small but powerful macro language for XML. The presented language supports macros with arguments. As a main result we will show that for a macro expansion $H$ and a recognizable set $R$ the set $H-1(R)$ of trees t, whose macro expansion H(t) are in R, is recognizable. This implies that the typechecking problem for macro expansion is decidable. A major drawback of this approach is the time complexity. Therefore we designed a practical typechecking discipline. We equip every macro definition with a type expression describing the input forests. On the basis of this type information the macro processor computes an output type for the macro. Having inferred this output type, we aim at extending the given output DTD to a DTD for admissible input possibly containing unexpanded macros

Download: PDF Reference: Bibtex