Code Generation Using XML Based Document Transformation

Java Development News:

Code Generation Using XML Based Document Transformation

By Soumen Sarkar and Craig Cleaveland

01 Nov 2001 |

Software projects can greatly benefit from custom document generators. The term 'document' in the context of a software project includes various software artifacts. A software project consists of various activities which lead to the production of documents in many forms. An example of such a document is a programming language file that is used to implement computational specifications. The document transformation approach, when applied to the particular area of code generation, incorporates a higher degree of automation into the software development life cycle. The benefits of this approach are model driven programming, automatic update propagation, and a higher degree of consistency enforced by a generative approach.

With recent interest in XML standards and availability of tools supporting these standards, it has become possible to generate multiple types of documents by applying XML document transformation technology. Using XML document transformation technology, it has become easier to develop custom code/document generators in application development projects.

An object based server side infrastructure was used in the 'sample' project referred to in this whitepaper. Object and relational model code generation coupled with object services provided by the EJB framework created a very powerful paradigm of server side infrastructure development. The project had a tremendous lead by being able to build further on this sophisticated server side infrastructure rather than spending time on building the infrastructure itself. The project was totally focused on building application logic and delivering functionality. Out of approximately 2300 java files in the project, 1900 files were generated.


This paper is mostly about how code generation aids speedier application software development. However, this paper will also highlight the fact that source code generation processing is a particular application of the broad technology of XML based document transformation.

Document generation is an old concept in software engineering. In our day-to-day activities in software development, we use document generators in the form of programming language compilers, program generators, and html document generators to name a few. However, software projects also rely on the availability of professionally developed tools to achieve generation in some fixed areas. Professionally developed tools may not be free and may not be suited to the custom requirements of a software project. On the other hand, existing approaches to generation from custom language specifications are not easy to implement.

In the opinion of the authors, complexities in the current approach to code/document generation have impeded widespread acceptability of the generative approach in application software development projects. This article will show how current XML based standards and freely available tools supporting these standards provide an easier way to develop custom code/document generators.

To read the rest of this document in PDF format, please view:
Code Generation Using XML Based Document Transformation