O'Reilly logo

JasperReports 3.5 for Java Developers by David Heffelfinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

XML datasources

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'll need an XML file from which we'll read the data. 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> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required