Example 2: Importing an HDS from an XML file to a catalog

To import an HDS from an XML file, follow the steps below:

  1. Start JReport Designer and open an existing catalog.
  2. In the Data tab of the Catalog Browser, right-click the data source to which to add the HDS, and then select Add XML Hierarchical Data Source from the shortcut menu. The Import XML Hierarchical Data Source dialog appears. See the dialog.
  3. Provide the information respectively according to your data source information.

    JReport Designer supports all kinds of URI as the XML data source. See the detailed information below:

  4. Click OK to import the HDS.

Notes:

The XSD file

When you import an XML format HDS with an XSD file, the XML file only provides the data to the JReport Designer reports, while the structure, data type, and so on of the data from the XML file is defined in the XSD file. That is, the structure of the HDS is determined by the XSD file. You should be aware of the following points about the XSD file in order to generate a correct report based on an XML format HDS with an XSD file.

Data type conversion table

Before the data type defined in the XSD file can function with JReport Designer, it should first be converted into a corresponding data type when the XML format hierarchical data source is imported, following the rules in the conversion table below.

XML Data Type JReport Data Type
SchemaSymbols.ATTVAL_BOOLEAN java.sql.Types.BIT
SchemaSymbols.ATTVAL_INT java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_SHORT java.sql.Types.SMALLINT
SchemaSymbols.ATTVAL_BYTE java.sql.Types.TINYINT
SchemaSymbols.ATTVAL_INTEGER java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_NONPOSITIVEINTEGER java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_NEGATIVEINTEGER java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_NONNEGATIVEINTEGER java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_UNSIGNEDLONG java.sql.Types.BIGINT
SchemaSymbols.ATTVAL_LONG java.sql.Types.BIGINT
SchemaSymbols.ATTVAL_UNSIGNEDINT, //4294967295 java.sql.Types.BIGINT
SchemaSymbols.ATTVAL_UNSIGNEDSHORT, //65535  java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_UNSIGNEDBYTE, //255 java.sql.Types.SMALLINT
SchemaSymbols.ATTVAL_POSITIVEINTEGER java.sql.Types.INTEGER
SchemaSymbols.ATTVAL_FLOAT java.sql.Types.FLOAT
SchemaSymbols.ATTVAL_DOUBLE java.sql.Types.DOUBLE
SchemaSymbols.ATTVAL_DECIMAL java.sql.Types.DECIMAL
SchemaSymbols.ATTVAL_STRING java.sql.Types.VARCHAR
SchemaSymbols.ATTVAL_DATE java.sql.Types.DATE
SchemaSymbols.ATTVAL_TIME java.sql.Types.TIME
SchemaSymbols.ATTVAL_DATETIME java.sql.Types.TIMESTAMP
SchemaSymbols.ATTVAL_HEXBINARY java.sql.Types.LONGVARBINARY

Note: When you import data of List type from an XSD file, you can define the delimiter through the property List Delimiter in the Report Inspector.

XSD structure supported by JReport Designer

In JReport Designer, not all XSD structures can be supported. The following diagrams show which structures are supported by JReport Designer.