When you import the XML format HDS with XSD file, the XML file only provides the data to JReport Designer reports, and the structure, data type and so on of the data from the XML file is defined in the XSD file, that is to say, the structure of the HDS is determined by the XSD file. So it is important to know the following points about the XSD file to generate a correct report based on the XML format HDS with XSD file.
Before it can work with JReport Designer, the data type defined in the XSD file should be converted to the corresponding data type when the XML format hierarchical data source is imported, which follows the rules in the conversion table:
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
In JReport Designer, not all the structure of XSD can be supported. For the structure supported by JReport Designer, please refer to the following diagrams.
- The ComplexType
Notes:
1). The type of the Element in the diagram can be simpleType, ref, or complexType (it is different from the ComplexType in the root of this diagram. It should be global complexType but can not be the anonymous one. If you have defined a complexType named A, and in this complexType A redefined an element as complexType named B, then the elements belong to complexType B must be the simpleType).
2). The type of Attribute in the diagram should be the anonymous type or the schema built-in type, such asxs:string.- The SimpleType
Note:
The SimpleType here should be the schema built-in type, such asxs:string, and the List type here can not support some facts, such as minLength, and maxLength.- The Element
Note:
The ComplexType here can include both of global and anonymous compexType.The anonymous type means you do not give a name to the type, for example,
<xs:element name="aa">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Julie P. Adams"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
From the code above, you can see that thesimpleTypein the elementaahas no name specified.
When you import a List type of data from the XSD file, you can define the delimiter through the property ValueDelimiter in the Report Inspector. By default, the value of ValueDelimiter is " LF", which means the elements will be displayed in a horizontal line and separated by a space from each other. If you want them to be separated by commas, change the property to a comma. If you want them to be shown in a vertical line, keep the default value of the ValueDelimiter property, and change the WordWrap property to be true.
Here is an example:
The element Numbers is a List type data, and the Array column is checked automatically.
After you create the report, if you keep the default value of ValueDelimiter, when you view the report, the elements in the Numbers column will be shown like this:
When change ValueDelimiter to a comma,
![]()
When keep the default value of ValueDelimiter and make the WordWrap value to be true,