July 29, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Developing an Eclipse BIRT XML Report Rendering Extension

  • March 6, 2008
  • By Jason Weathersby, Iana Chatalbasheva, and Tom Bondur
  • Send Email »
  • More Articles »

Listing 10 shows the values of the patterns for the XML version, text, image, data, label, and report tags specified in the XML Schema file.

Listing 10: The XML Schema file

start=<?xml version="1.0" encoding="UTF-8"?>
report=<report name=??name>
label=<label name=??name hyperlink=??hyperlink>??value</label>
text=<text name=??name>??value</text>
image=<image name=??name>??value</image>
data=<data>??value</data>
end=</report>

Testing the XML report rendering plug-in

To test the XML report rendering example, create a Java application that runs a report design in an installation of the BIRT run-time engine, similar to application created to run the CSV report rendering example.

To test the XML report rendering plug-in, perform the following tasks:

  • Build the org.eclipse.birt.report.engine.emitter.xml plug-in.
  • Deploy the plug-in to the BIRT run-time engine directory.
  • Launch a run-time instance of the Eclipse PDE.
  • Create a Java application that runs the report design and writes the report's data to an XML file.
  • Create a report design containing a table that maps to a data source and data set.
  • Run the application and examine the XML in the output file.

Figure 2 shows the report design used in the XML report rendering example.

Figure 2: Report design for the XML report rendering example

Listing 11 shows the contents of the XML output file, containing XML version, text, image, data, label, and report tags for an executed report.

Listing 11: Contents of the XML output file

<?xml version="1.0" encoding="UTF-8"?>
<report name=
   C:/IANA/2007/runtime-XMLEmitter/ExecuteXMLReport/reports/
   xmlReport.rptdesign>
   <image name=>
      /9j/4AAQSkZJRgABAgEBLAEsAAD
      /4RVaRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
      ...
      7PMv9I9nVo5cj8b7MV9zB/gh8cf/2Q==
   </image>
   <label
      name= hyperlink=http://www.actuate.com>Company Name
   </label>
   <label name= hyperlink=>Report</label>
   <label name= hyperlink=>PRODUCTNAME</label>
   <label name= hyperlink=>QUANTITYINSTOCK</label>
   <label name= hyperlink=>MSRP</label>
   <data>1969 Harley Davidson Ultimate Chopper</data>
   <data>7933</data>
   <data>95.7</data>
   <data>1952 Alpine Renault 1300</data>
   <data>7305</data>
   <data>214.3</data>
   <data>1996 Moto Guzzi 1100i</data>
   <data>6625</data>
   <data>118.94</data>
   <data>2003 Harley-Davidson Eagle Drag Bike</data>
   <data>5582</data>
   <data>193.66</data>
   ...
   <data>American Airlines: MD-11S</data>
   <data>8820</data>
   <data>74.03</data>
   <data>Boeing X-32A JSF</data>
   <data>4857</data>
   <data>49.66</data>
   <data>Pont Yacht</data>
   <data>414</data>
   <data>54.6</data>
</report>

About the Book Excerpt

This article is an excerpt from the book, Integrating and Extending BIRT, by Jason Weathersby, Don French, Tom Bondur, Jane Tatchell, and Iana Chatalbasheva, published by Addison-Wesley. The book is the second volume in a two-book series about business intelligence and reporting technology. The book introduces programmers to BIRT architecture and the reporting framework. It shows programmers how to build and deploy customized reports using scripting and BIRT APIs. It also describes how to use key extension points to create customized report items, rendering extensions for generating output other than HTML or PDF, and Open Data Access (ODA) drivers for new data sources.

About the Authors

The authors, Jason Weathersby, Iana Chatalbasheva, and Tom Bondur, are members of the extended BIRT development team and all have backgrounds in both computer science and technical writing. Collectively, they have many years experience in technical consulting, training, writing, and publishing about reporting, business intelligence tools, and database technologies.

About BIRT Exchange

Additional helpful resources related to BIRT are avaliable at BIRT Exchange http://www.birt-exchange.com, a community site for developers who need to build reporting into applications. BIRT Exchange offers downloads, online documentation, forums, and other resources that let developers share technical tips, code snippets, and ideas.





Page 6 of 6



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel