A method and apparatus for converting programs and source code files written
in
a programming language to equivalent markup language files is provided. The conversion
may be accomplished by a static process or by a dynamic process. In a static process,
a programming source code file is converted by an application to a markup language
file. A document type definition file for a markup language is parsed; a source
code statement from a source code file is parsed; an element defined in the document
type definition file is selected based on an association between the element and
an identifier of a routine in the source code statement; and the selected element
is written to a markup language file. In a dynamic process, the program is executed
to generate the markup language file that corresponds to the source code file or
presentation steps of the program. The application program is executed; a document
type definition file for a markup language is provided as input; an element defined
in the document type definition file is selected based on a routine called by the
application program; and the selected element is written to a markup language file.