Viewing: Advanced Domain Features > Top-level Elements of a Design File

Structure of the Design File

This section explains each of the XML elements and attributes in a design file and how they relate to the settings in the Domain Designer. The sample XML code is based on Example of Creating a Domain, with table names that do not include database schema names. Some elements have been added to show structures that did not appear in the example.

Because certain XML elements correspond to objects in the Domain design, this section refers to XML elements that contain Domain objects such as sets. This is a short-hand description that means the XML elements contain other XML elements that represent the Domain objects.

Top-level Elements of a Design File

The top-level container elements of a design file are:

schema (no relationship to the database schema)
itemGroups
items
resources

The following schema representation shows the top-level structure of the design file:

<schema xmlns="http://www.jaspersoft.com/2007/SL/XMLSchema" version="1.0"
    schemaLocation="schema_1_0.xsd">
 <itemGroups>...
 </itemGroups>
 <items>...
 </items>
 <resources>...
 </resources>
</schema>
schema – The outer-most container element of a design file.

When exported from the Domain Designer, the schema element includes the xmlns and version attributes.

     The xmlns attribute specifies an XML namespace for all element names.

This string must be unique to Jaspersoft, but it does not correspond to a valid URL. For more information, see http://www.w3.org/TR/REC-xml-names.

     The version attribute gives the version of the XSD used to create this design file.
     The schemaLocation attribute is often added by XML editors to locate the XSD file.
itemGroups – Contains all the sets and items within sets in the Domain.

Along with items, this element corresponds to all the sets and items defined on the Display tab of the Domain Designer. Therefore, itemGroups and items determine what users see when they create a report based on this Domain. The sets and items defined under itemGroups and items must be internally consistent with the tables and columns under resources.

items – Contains all the items that are not within sets.

These correspond to the items at the root level of the Display tab. When all items are contained in sets, this element is absent.

resources – Contains all the definitions in the design:
     columns
     tables
     derived tables
     joins
     calculated fields
     filters

These definitions in the design correspond to the first five tabs of the Domain Designer:

Domain Designer Tabs

Because the elements under resources refer to database objects, they must be externally consistent with the data source intended for this Domain.

although the itemGroups appear first in the design file, this section documents the resources first present design elements in the same order as the tabs of the Domain Designer.

The resources element contains the jdbcTable and jdbcQuery elements to represent database tables and derived tables, respectively. Join trees are represented as a jdbcTable element with additional contents to define the joins.

<resources>
 <jdbcTable datasourceId="SugarCRMDataSource" tableName="accounts" id="accounts">
  ...
 </jdbcTable>
 <jdbcTable datasourceId="SugarCRMDataSource" tableName="accounts_opportunities"
       id="accounts_opportunities">
  ...
 </jdbcTable>
 <jdbcTable datasourceId="SugarCRMDataSource" tableName="opportunities"
       id="opportunities">
   ...
  <filterString>opportunity_type == 'Existing Business'</filterString>
 </jdbcTable>
 <jdbcQuery datasourceId="SugarCRMDataSource" id="p1cases">
  <fieldList>
   <field id="account_id" type="java.lang.String"/>
   <field id="assigned_user_id" type="java.lang.String"/>
   <field id="case_number" type="java.lang.Integer"/>
   <field id="date_entered" type="java.sql.Timestamp"/>
   <field id="description" type="java.lang.String"/>
   <field id="id" type="java.lang.String"/>
   <field id="name" type="java.lang.String"/>
   <field id="resolution" type="java.lang.String"/>
   <field id="status" type="java.lang.String"/>
  </fieldList>
  <filterString>status != 'closed'</filterString>
  <query>select * from cases where cases.priority=1 and cases.deleted=false</query>
 </jdbcQuery>
 <jdbcTable datasourceId="SugarCRMDataSource" tableName="users" id="users1">
  ...
 </jdbcTable>
 <jdbcTable datasourceId="SugarCRMDataSource" tableName="users" id="users2">
  ...
 </jdbcTable>
 <jdbcTable datasourceId="SugarCRMDataSource" tableName="accounts" id="JoinTree_1">
  ...
 </jdbcTable>
</resources>