Example which wraps the Jasper reports design object tree to xml.
Example xml document which can be parsed.
<?xml version="1.0" encoding="UTF-8"?> <report> <!-- Format is made JR compatible for easy copy/paste except; - style tags need el.id for reference in docs and dynamic report elements. - can use multiple reports in one xml - not all JR tags are supported only the ones needed for ~this report see jr4o-lang.eld file. --> <jasperReport name="generic-landscape" columnCount="1" pageWidth="842" pageHeight="595" columnWidth="800" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" orientation="LANDSCAPE"> <style el.id="Arial_Normal" name="Arial_Normal" isDefault="true" fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style el.id="Arial_Bold" name="Arial_Bold" isDefault="false" fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style el.id="Arial_Italic" name="Arial_Italic" isDefault="false" fontName="Arial" size="10" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style el.id="Arial_Header" name="Arial_Header" isDefault="false" fontName="Arial" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <title tagType="title" height="60"> <line x="0" y="0" width="800" height="1"/> <textField isBlankWhenNull="true" x="40" y="10" width="276" height="30" style="${Arial_Normal}" fontSize="18"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true" x="40" y="30" width="200" height="30" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{description}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true" x="350" y="30" width="150" height="16" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression> </textField> </title> <columnHeader tagType="columnHeader" height="20"> <dynamicColumnHeader/> </columnHeader> <detail tagType="detail" height="20"> <line x="0" y="0" width="800" height="1"/> <dynamicColumn/> </detail> <pageFooter tagType="pageFooter" height="40"> <line x="0" y="10" width="800" height="1"/> <textField isBlankWhenNull="true" x="20" y="20" width="150" height="16" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression> </textField> <textField x="200" y="20" width="80" height="15" horizontalAlignment="RIGHT"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.page}+" "+String.valueOf($V{PAGE_NUMBER})+" "]]></textFieldExpression> </textField> <textField x="280" y="20" width="100" height="15" evaluationTime="REPORT"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.pageOf}+String.valueOf($V{PAGE_NUMBER})+" "+$R{report.footer.printed}]]></textFieldExpression> </textField> <textField x="370" y="20" width="150" height="15" pattern="dd-MM-yyyy - HH:mm:ss"> <textFieldExpression valueClass="java.util.Date"><![CDATA[new Date()]]></textFieldExpression> </textField> <textField isBlankWhenNull="true" x="650" y="20" width="150" height="16" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression> </textField> </pageFooter> <summary tagType="summary" height="35"> </summary> </jasperReport> <jasperReport name="generic-portrait" columnCount="1" pageWidth="595" pageHeight="842" columnWidth="554" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" orientation="LANDSCAPE"> <style el.id="Arial_Normal" name="Arial_Normal" isDefault="true" fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style el.id="Arial_Bold" name="Arial_Bold" isDefault="false" fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style el.id="Arial_Italic" name="Arial_Italic" isDefault="false" fontName="Arial" size="10" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" /> <style el.id="Arial_Header" name="Arial_Header" isDefault="false" fontName="Arial" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <title tagType="title" height="60"> <line x="0" y="0" width="800" height="1"/> <textField isBlankWhenNull="true" x="40" y="10" width="276" height="30" style="${Arial_Normal}" fontSize="18"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true" x="40" y="30" width="200" height="30" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{description}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true" x="350" y="30" width="150" height="16" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression> </textField> </title> <columnHeader tagType="columnHeader" height="20"> <dynamicColumnHeader/> </columnHeader> <detail tagType="detail" height="20"> <line x="0" y="0" width="800" height="1"/> <dynamicColumn/> </detail> <pageFooter tagType="pageFooter" height="40"> <line x="0" y="10" width="800" height="1"/> <textField isBlankWhenNull="true" x="20" y="20" width="150" height="16" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression> </textField> <textField x="200" y="20" width="80" height="15" horizontalAlignment="RIGHT"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.page}+" "+String.valueOf($V{PAGE_NUMBER})+" "]]></textFieldExpression> </textField> <textField x="280" y="20" width="100" height="15" evaluationTime="REPORT"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.pageOf}+String.valueOf($V{PAGE_NUMBER})+" "+$R{report.footer.printed}]]></textFieldExpression> </textField> <textField x="370" y="20" width="150" height="15" pattern="dd-MM-yyyy - HH:mm:ss"> <textFieldExpression valueClass="java.util.Date"><![CDATA[new Date()]]></textFieldExpression> </textField> <textField isBlankWhenNull="true" x="650" y="20" width="150" height="16" style="${Arial_Normal}"> <textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression> </textField> </pageFooter> <summary tagType="summary" height="35"> </summary> </jasperReport> </report>