### Setting up an XML connection

To set up an XML connection to connect a JReport catalog to an XML data source, follow the steps below:

1. Create a catalog or open a catalog, then in the Data tab of the Catalog Browser, right-click the node of a data source and choose Add XML Connection from the shortcut menu.

   If you want to set up the connection by adding a data source to an existing catalog and then defining the connection on the data source, open the catalog, select any data source contained in it, click the New Data Source button on the Catalog Browser toolbar, then in the New Data source dialog, specify the name of the data source, select the XML connection type and click OK.

   The XML Connection Wizard appears.

2. In the Import XML Schema screen, provide the required information for importing an XML schema. See the screen.

   - If Import from XSD is selected from the Schema Type drop-down list,
     1. Click the Browse button next to the Schema Name text field to specify the schema file.
     2. From the Starting Node drop-down list, specify the starting node accordingly.
     3. Specify the XML instance file. You can specify the file directly or use a parameter to do this at runtime.

        To specify the file directly, check the URI radio button, and click Browse to specify the instance file. To use a parameter to specify the file at runtime, check the Parameter radio button and then select the parameter from the Instance drop-down list or click to create one.

     4. Check the Validate with schema before fetching to validate whether or not values in the XML instance is valid according to the W3C standard and the selected XSD schema.
     5. Click the Time Zone and Locale button to specify the time zone and the locale as required.
   - If Parse from XML Instance is selected from the Schema Type drop-down list, specify the instance file and time zone and the locale as required.

   When done, click Next to go to the next screen.

3. In the Modify Schema Properties screen, supplement and modify the element properties as required and then click Next.
4. In the Transform XML Schema screen, select an XPath to be the transforming start point, and then click Next.
5. In the Transformed Relational Schema screen, check the transformed result, and then click Next.
6. In the Add Table screen, add the required tables to the connection, and check the Generate the default pre-join path checkbox for generating default pre-join paths for tables of the XML data source.
7. Click Finish to confirm the transformed result and finalize the transformation process.