Create the data schema (xsd) from a Java data source
After you write or modify a Java report program, generate the data schema (xsd) file. This file is required input for the Report Design Document.
The data schema (xsd) file is based on the data model in your Java report application source file (java). This xsd file is used in the report design document (4rd) to populate the Data View, providing details about the fields that will be streamed by the application. The schema contains the list of database columns that make up your data record, as well as grouping details.
There are two options for creating a data schema:
Regardless of the method used, a data schema file is created. For example, the
Sales.java file shown in Source code for a simple Java report application
results in the schema file shown
here:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sales" type="sales"/>
<xs:complexType name="sales">
<xs:sequence>
<xs:element name="shopName" type="xs:string" nillable="true"/>
<xs:element name="zipCode" type="xs:int"/>
<xs:element name="day" type="xs:dateTime" nillable="true"/>
<xs:element name="items" type="salesItem" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="salesItem">
<xs:sequence>
<xs:element name="articleName" type="xs:string" nillable="true"/>
<xs:element name="category" type="category" nillable="true"/>
<xs:element name="price" type="xs:double"/>
<xs:element name="runningTotal" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="category">
<xs:restriction base="xs:string">
<xs:enumeration value="Furniture"/>
<xs:enumeration value="Art"/>
<xs:enumeration value="Supplies"/>
<xs:enumeration value="Travelling"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>