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.
Note
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>...