In order to transform the imported XML schema to the relational schema, you can choose to import an XML schema by importing the structure of an XML data source and the information of its elements that are recorded in an XSD file.
You should be aware of the following about XSD in order to generate a correct imported XML schema:
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 schema is imported, following the rules in the conversion table below.
XSD Data Type | SQL Data Type |
---|---|
BOOLEAN | BIT |
BYTE | TINYINT |
UNSIGNEDBYTE | SMALLINT |
SHORT | SMALLINT |
UNSIGNEDSHORT | INTEGER |
INT | INTEGER |
UNSIGNEDINT | BIGINT |
LONG | BIGINT |
UNSIGNEDLONG | DECIMAL |
NEGATIVEINTEGER | DECIMAL |
NONPOSITIVEINGEGER | DECIMAL |
POSITIVEINTEGER | DECIMAL |
NONNEGATIVEINTEGER | DECIMAL |
INTEGER | DECIMAL |
FLOAT | FLOAT |
DOUBLE | DOUBLE |
DECIMAL | DECIMAL |
STRING | VARCHAR |
NORMALIZEDSTRING | VARCHAR |
TOKEN | VARCHAR |
LANGUAGE | VARCHAR |
NAME | VARCHAR |
NMTOKEN | VARCHAR |
NMTOKENS | VARCHAR |
NCNAME | VARCHAR |
ID | VARCHAR |
IDREF | VARCHAR |
ENTITY | VARCHAR |
IDREFS | VARCHAR |
ENTITIES | VARCHAR |
ANYSIMPLETYPE | VARCHAR |
GYEAR | VARCHAR |
GYEARMONTH | VARCHAR |
GMONTH | VARCHAR |
GMONTHDAY | VARCHAR |
GDAY | VARCHAR |
DATE | DATE |
TIME | TIME |
DATETIME | TIMESTAMP |
HEXBINARY | BLOB |
BASE64BINARY | BLOB |
In JReport Designer, not all XSD syntax can be supported. The following diagram shows the XSD syntax that is supported by JReport Designer and syntax is in accordance with the W3C standard:
XML Schema::=
Text description of the XML Schema:
annotation*, ((element declaration | SimpleType| ComplexType | notation), annotation*)*;
Notes:
The following are diagrams show the detail syntax of elements in the above diagram:
Text description of the Element Declaration:
element declaration:= annotation?, SimpleType | ComplexType;
Text description of the SimpleType:
anonymous simpleType definition | simpleType definition;
Note: The SimpleType here should be of the schema built-in type, such as xs:string.
Text description of the Anonymous SimpleType Definition:
annotation?, (restriction | list);
Note: List type here cannot support some functions, such as minLength, and maxLength.
Text description of the SimpleType Definition:
name, annotation?, (restriction | list)
Text description of the ComplexType:
anonymous ComplexType definition | ComplexType definition;
Text description of the Anonymous ComplexType Definition:
annotation?, (ComplexContent | ((all | choice | sequence)?, attribute*));
Text description of the ComplexType Definition:
name, annotation?, (ComplexContent | ((all | choice | sequence)?, attribute*));
Text description of the All:
annotation?, element*;
Text description of the Choice:
annotation?, (element | choice | sequence)*;
Text description of the Sequence:
annotation?, (element | choice | sequence)*;
Default namespace (3w) and target namespace are supported by JReport Designer. You can define a prefix for the default namespace, such as xs, or xsd, but the value of elementFormDefault must be qualified. The value of attributeFormDefault should be unqualified, but JReport Designer will not allow you to add prefixes before the attributes of the elements.