You can use a file with the .xml extension for your source, although this can slow your compilation. JasperReports works best with the .jrxml extension.
An example of a report design file follows:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE jasperReport PUBLIC
"//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="simpleReport">
<field name="CUSTOMER_ID" class="java.lang.String" />
<field name="FIRST_NAME" class="java.lang.String" />
<field name="LAST_NAME" class="java.lang.String" />
<field name="PHONE" class="java.lang.String" />
<pageHeader>
<band height="30">
<staticText>
<reportElement x="0" y="0" width="70" height="24" />
<text>
<![CDATA[Customer ID: ]]>
</text>
</staticText>
<staticText>
<reportElement x="140" y="0" width="70" height="24" />
<text>
<![CDATA[First name: ]]>
</text>
</staticText>
<staticText>
<reportElement x="280" y="0" width="70" height="24" />
<text>
<![CDATA[Last name: ]]>
</text>
</staticText>
<staticText>
<reportElement x="420" y="0" width="70" height="24" />
<text>
<![CDATA[Phone: ]]>
</text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="30">
<textField>
<reportElement x="0" y="0" width="70" height="24" />
<textFieldExpression>
<![CDATA[$F{CUSTOMER_ID}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="140" y="0" width="70" height="24" />
<textFieldExpression>
<![CDATA[$F{FIRST_NAME}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="280" y="0" width="70" height="24" />
<textFieldExpression>
<![CDATA[$F{LAST_NAME}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="420" y="0" width="70" height="24" />
<textFieldExpression>
<![CDATA[$F{PHONE}]]>
</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
This example report design file prints four columns of information: an ID number, a first name, a last name, and a phone number. The <pageHeader> section prints column headers, and the <detail> section prints rows of data based on the data provided by the report driver program.
The following sections offer specifics for the different types of XML source files. This information covers very simple cases; for more complex examples see either the JasperReports website mentioned earlier or the documentation for your design tool (if you decide to use one).
<queryString><![CDATA[SELECT * FROM Table_Name]]></queryString>
<field name="Field_Name" class="java.lang.class_type"></field>
<textFieldExpression class="java.lang.class_type">
<![CDATA[$F{Field_Name}]]>
</textFieldExpression>
<field name="Field_Name" class="java.lang.class_type"></field>
<textFieldExpression class="java.lang.class_type">
<![CDATA[$F{Field_Name}]]>
</textFieldExpression>
<field name="Field_Name" class="java.lang.class_type"></field>
<textFieldExpression class="java.lang.class_type">
<![CDATA[$F{Field_Name}]]>
</textFieldExpression>
EGL places the compiled .jasper file in the Java Resources\package_name directory that is parallel to EGLSource\package_name. When you successfully generate your EGL report driver, the product places a linked copy of the .jasper file in the parallel bin\package_name directory. You can manually create and copy the .jasper file by selecting or .
For guidelines on creating an XML design document and a report handler simultaneously, see Creating reports with JasperReports. For an example that shows how an XML design document gets a report data record from the report handler, see Writing code to drive a report of type JasperReport.