#### Importing from an XSD file

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:

##### 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 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

##### XSD syntax supported by JReport Designer

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:

- When a ComplexType is being defined, the element of which cannot be declared as an anonymous ComplexType.
- Neither loop nor network structures can be defined in the ComplexType, so direct or indirect recursion cannot occur when defining a ComplexType. That is, the type of the element declared in the ComplexType cannot be that defined in the current direct or indirect context.
- Only the anonymous attribute definition is supported by JReport Designer.

The following are diagrams show the detail syntax of elements in the above diagram:

- Element Declaration::=

  Text description of the Element Declaration:

  `element declaration:= annotation?, SimpleType | ComplexType;`

- SimpleType::=

  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.

- Anonymous SimpleType Definition::=

  Text description of the Anonymous SimpleType Definition:

  `annotation?, (restriction | list);`

  Note: List type here cannot support some functions, such as minLength, and maxLength.

- SimpleType Definition::=

  Text description of the SimpleType Definition:

  `name, annotation?, (restriction | list)`

- ComplexType::=

  Text description of the ComplexType:

  `anonymous ComplexType definition | ComplexType definition;`

- Anonymous ComplexType Definition::=

  Text description of the Anonymous ComplexType Definition:

  `annotation?, (ComplexContent | ((all | choice | sequence)?, attribute*));`

- ComplexType Definition::=

  Text description of the ComplexType Definition:

  `name, annotation?, (ComplexContent | ((all | choice | sequence)?, attribute*));`

- All::=

  Text description of the All:

  `annotation?, element*;`

- Choice::=

  Text description of the Choice:

  `annotation?, (element | choice | sequence)*;`

- Sequence::=

  Text description of the Sequence:

  `annotation?, (element | choice | sequence)*;`

##### Namespace limitation in the XSD file

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.