My first days at AMIS I examined JasperReports (v. 0.6.3), an open source report-generating library. This tool is entirely written in Java and uses XML report templates to generate reports you can display on the screen, send to a printer, or save as a PDF document.
In order to fill a report with data, the report design (template) must be compiled first.
This compilation is performed by the compileReport() method exposed by the net.sf.jasperreports.engine.JasperCompileManager class.
Through compilation, the report design is loaded into a report design object that is then serialized and stored on disk (net.sf.jasperreports.engine.JasperReport). This serialized object is then used when the application wants to fill the specified report design with data. In fact, the compilation of a report design implies the compilation of all Java expressions defined in the XML file representing the report design. Various verifications are made at compilation time, to check the report design consistency. The result is a ready to fill report design that will be then used to generate documents on different sets of data.