XML is indisputably the long-awaited lingua franca for defining and transmitting structured data. With a little help from XSL, it can also generate C++ code for you.
Introduction
Dealing with complexity is one of the biggest challenges of programming. There is a great need for tools that help us to better understand and manage software complexity. Such tools would not only help create better code, but would also increase software development productivity. Code generators are tools that generate complex code from a simpler model. Code generators are therefore an ideal candidate for helping cope with software complexity.
XML is an open standard of the W3C (World Wide Web Consortium) designed for describing structured data. XSL (eXtensible Stylesheet Language) is a companion language used to transform and format XML. While XML is a way of representing information, XSL is the language for manipulating information [1].
XML and XSL have emerged from the need to exchange and present data over the Internet. Another reason for the emphatic acceptance of XML is that this technology has an unprecedented capability to yield surprisingly elegant solutions for the most unexpected problems. And perhaps the best kept secret of today’s hype around XSL is that it gives you the power to create your own code generators. Using XML and XSL together to create custom code generation templates may be yet another killer app for these two technologies.
In this article, I will explore the possibility of creating custom code generators using XML and XSL by presenting a simple example. XML will contain a representation of the conceptual model of the problem, whereas XSL will do the work of generating the code, based on information extracted from the XML model.<>