A method for generating markup language documents, e.g., XML documents,
uses a code generator that creates programs configured to create dynamic
XML documents at run time, avoiding many of the complexities arising from
the use of conventional "XML GENERATE" statements. In one embodiment,
this process involves (1) creating a template document using a markup
language, wherein the template document includes a set of tags associated
with the markup language documents; (2) parsing the template document to
determine a working storage structure corresponding to the tags in the
template document; and (3) generating an application program in the
programming language (e.g., COBOL), wherein the application program
includes a definition of the working storage structure, and is configured
to generate, during run-time, a markup language document corresponding to
the original template document.