Example 2: Importing the XML File Directly
The process of importing an XML file with Model Wizard (as explained in Example 1) can be simplified with Logi JReport's built-in XML file import functionality, and is very easy to use.
In this example, orgchart_data.xml in
<install_root>\help\samples\OOJDBC will be used. Store it to
<install_root>\Demo\Reports\TutorialReports first. Then follow the steps below to import the file to a catalog.
Below is a list of the sections covered in this topic:
To import the XML file directly using the Model Wizard, take the following steps:
- Run ModelWizard.bat in
<install_root>\binto open the Object Source Wizard.
- Select File > Import XML Files to bring up the Import XML dialog.
- Select Open to browse to the file orgchart_data.xml.
- Check Column for all elements and change their format and type if necessary (for the details about how to set the format, see Examples of format).
- Select OK and the table OrgChart will now have been added to the Object Source Wizard.
- In the Object Source Wizard, select File > Save. You will then be prompted to save the ODF file. You should save it to
<install_root>\libor to the directory where the catalog will be located. Here, we save it as orgchart.odf.
Note: The same ODF file cannot exist in
both <install_root>\liband the directory where the catalog will be located.
When using certain SQL types, you should input a standard format in the Format cell in the Import XML dialog. There are some examples:
- If the time format is like Tue Aug 27 16:04:00 BST 2002, you should select:
Format: EEE MMM dd hh:mxm:ss zzz yyyy
- If the time format is like 2002-11-22 11:09:08, you should select:
Format: yyyy-MM-dd hh:mm:ss
- If the time format is like 11/18/2002 08:20:00, you should select
Format: M/d/yyyy hh:mm:ss
- If the time format is like 1999-12-05, you should select:
- If the time format is like 08:20:00, you should select:
- If the number is like 50,600, you should select:
- If the currency is like $50,600, you should select:
To import the generated orgchart.odf file into a Logi JReport catalog, take the following steps:
- Start Logi JReport Designer.
- Select File > New Catalog.
- In the New Catalog dialog, specify the catalog name, the data source name and the path. The catalog should be located in the directory where you saved the ODF file. For example, if you saved the ODF file in
C:\odf, the new catalog should be created also in
- In the Catalog Manager, right-click the data source node and select New JDBC Connection from the shortcut menu. Select JDBC in the Select Connection Type dialog.
- In the Get JDBC Connection Information dialog, enter com.jinfonet.jdbc.obj.ObjectDriver in the Driver text field, type jdbc:jinfonet:object:@Filename in the URL text field. @Filename should be the ODF file name. In the example, it is jdbc:jinfonet:object:@orgchart.
Select OK to set up the connection.
- In the prompted guidance dialog, select Add Tables.
- In the Add Tables/Views/Synonyms dialog, select the table OrgChart and select Add.
- Select Done to close the Add Tables dialog.
Now, the table OrgChart will be added into the catalog. You can use it to develop reports as required.
Note: When you publish the catalog and its reports to Logi JReport Server, whether the ODF file is located in
<install_root>\lib or in the directory where the catalog is located, it will be deployed to the path where the catalog is located on the server side.