|JReport Tech Tip:
Setting up XML connections
JReport 8 supports XML data sources in the same easy-to-use manner that JDBC data sources are supported. Report developers no longer need to use the proprietary OOJDBC or HDS interfaces to access XML data sources. JReport Designer can parse the schema from XML instances or import them from XSD, and then transform them to relational tables. Once the relational tables are created they can be used in queries just like tables from any other data source:
Figure 1: Catalog Browser showing XML converted to hierarchical tables
Both types of XML connectionsparsing from XML instances and importing from XSDare defined by using the XML Connection Wizard:
Figure 2: XML Connection Wizard
To access the XML Connection Wizard, open the Data tab of the Catalog Browser, right-click the Relational node and select Add XML Connection....
The wizard collects the needed information for each schema type. If importing from an XSD file, you will need to specify the starting node of the XML data. If parsing from an XML instance, the starting node is automatically determined by the XML Connection Wizard. The starting node is the root of the XML tree.
Note that the actual XML instance file to be parsed can be supplied at runtime. To do this, specify a parameter in the XML Connection Wizard. When the report based on the XML connection is run, the end user will need to specify the XML instance file on the Enter Parameter Values dialog.
For more information about XML connections, see "XML connections" in the "Data Source Connections" chapter of the JReport Designer User's Guide.