I've upgraded my open-source (Apache licensed) Kohmori Reports framework to now use JAXB internally. The new Version 1.1 is available in Kohmori's Maven repository, replacing the earlier 1.0.8 that relied on a manual POJO & SAX method. Switching to JAXB better formalizes the initial part of the report generation pipeline and removes much of the boilerplate code. The earlier manual process involved sketching the report data into an informal XML, manually creating a POJO to hold the data and an XML Reader to serialize it into XML. But that code is no longer necessary. With JAXB, you just need to create a Schema describing the report, then use the Maven JAXB plugin to automatically create the POJOs and then the super-convenient JAXBSource object to automatically handle the marshalling of the report POJO's to XML, necessary for its subsequent stylesheet processing. |
![]() |
These changes also further my goal of having Kohmori be a "no fat" project. All the technologies it uses--Java, Maven, Spring MVC, XSLT, XSL FO, and now XML Schema and JAXB are useful skills and most transfer easily to your other project needs. This report generation method also supports a high amount of code reuse, particularly within the report schemas and stylesheets, allowing you to build in more and more efficiencies with each additional report you create.
The Kohmori Wiki documentation has been updated for the new process. It shows how to deploy the sample Flight Reports webapp (which has three sample reports) to Tomcat and how to create a report from scratch. Kohmori supports PDF and RTF (using Apache FOP underneath for its rendering) and can also be used command-line. Enjoy!