Java Reference
In-Depth Information
Needs to be changed to:
jasperPrint = JasperFillManager.fillReport("reports/
AircraftReportColumnIndex.jasper ", new HashMap(),
new JRTableModelDataSource(tableModel));
If we hadn't changed the report name, then the code in the example would have
worked without modification with the new report template.
XML as Datasource
JasperReports allows us to use any well-formatted XML document as a datasource.
JasperReports uses XPath expressions to traverse the XML documents and extract
the data for the report.
XPath is a language used to navigate through an XML
document's attributes and elements. More information
about XPath can be found at
http://www.w3.org/TR/xpath .
For our next example, we are going to need an XML file to read data from. The
following XML document will serve this purpose:
<?xml version="1.0" encoding="UTF-8"?>
<AircraftData>
<aircraft>
<tail_num>N263Y</tail_num>
<aircraft_serial>T-11</aircraft_serial>
<aircraft_model>39 ROSCOE TRNR RACER</aircraft_model>
<engine_model>R1830 SERIES</engine_model>
</aircraft>
<aircraft>
<tail_num>N4087X</tail_num>
<aircraft_serial>BA100-163</aircraft_serial>
<aircraft_model>BRADLEY AEROBAT</aircraft_model>
<engine_model>R2800 SERIES</engine_model>
</aircraft>
<aircraft>
<tail_num>N43JE</tail_num>
<aircraft_serial>HAYABUSA 1</aircraft_serial>
<aircraft_model>NAKAJIMA KI-43 IIIA</aircraft_model>
<engine_model>R1830 SERIES</engine_model>
 
Search WWH ::




Custom Search