Minimal IT logo and link to home page
Research, training, consultancy and software to reduce IT costs
Home | About | Newsletter | Contact
Previous | Next Printer friendly
15 June 2010

XML-based programming 3: using the framework

By Andrew Clifford

Using XML-based programming simplifies web development, database handling and report production.

We use a simple framework for XML-based programming. It allows us to pass request parameters to functions using XML, and receive the results using XML.

Although it is only a simple framework, it provides good support for many different types of development, such as web development, database handling, and report production.

Web development

The framework provides a Java Server Page (JSP) tag which allows a Java server page to call an application service. The request for the service is written as XML in the body of the tag, and the results are returned as XML either into the document or into a variable for further processing.

This provides a consistent way of calling business logic from the user inteface code, and of handling the return values. Using XSLT to render the returned XML is very powerful.

Because XML can structure complicated data, this approach helps arrange the calls to the business logic into larger, more meaningful units, rather than things like "get next row".

This approach also achieves a very clear separation between the user interface code and the business logic, which was the main motivation for the framework in the first place.

Database handling

The framework does not of itself provide any support for database handling. However, to complement the XML-based programming, we developed a database utility which, as well as generating SQL and data access classes, supports XML-based dump and load facilities for the database. The load facilities are relatively intelligent, for example resolving business key values into internal foreign key relationships.

Because it is all XML-based, this works alongside the programming framework very effectively. For example, it allows us to initialise reference data directly within the application configuration files.

Report production

We had a requirement to produce finished reports in various formats. Working in an XML-based environment means that it is easy to extract XML data and pass it through XSLT stylesheets to produce the required output. We even developed an XSLT-based approach to creating Excel 2007 spreadsheets.

To provide additional flexibility, we created services that monitor the arrival of files in directories, and then trigger streams of processing on the files. These are configured using XML, and can run any XML-based service, including services for XML transformation using XSLT and a Shell service for running native programs. This allows us to configure multi-step report processes, for example (in our case) passing data through an expert system for analysis before reporting on it using XSLT.

Any of these examples could be developed in other ways. However, using an XML-based programming framework allows us to use the same code and the same tools to develop and integrate all the different parts of the application. XML gives us a consistent way to configure and combine both data and code, which gives us huge flexibility during development.

As well as making coding simpler, the use of XML has even greater benefits in testing. Next week I will describe XML-based testing.

Next: XML-based programming 4: testing

Subscription

To subscribe to the newlsetter, simply send an email to newsletter-subscribe@minimalit.com.
Privacy policy

Subscribe to RSS feed

Latest newsletter:
Magical metadata

We use the term "metadata-driven" to describe IT solutions in which functionality is defined in data. Taking this to the extreme can provide unparalleled levels of speed, simplicity and versatility.
Read full newsletter

System governance

System governance helps you implement high-quality systems, manage existing systems proactively, and improve failing systems.

Try it for free!

Find out more