Developing an Eclipse BIRT XML Report Rendering Extension, Page 4
Understanding XMLTags
The XMLTags class defines the controls and associated property lists used in analyzing the report contents, substituting the tag values, and writing the tag to the XML output file, as shown in Listing 5.
Listing 5: The XMLTags class
public class XMLTags
{
public static final String TAG_CR = "\n" ;
static String labelControl = "label";
static String textControl = "text";
static String imageControl = "image";
static String dataControl = "data";
static String reportControl = "report";
static String startControl = "start";
static String endControl = "end";
static String[] iPropList =
{"Bookmark","Height","Hyperlink","ImageMap",
"InlineStyle","MIMEType","Name","Style","TOC","URI",
"Width","X","Y"};
static String[] dPropList =
{"Bookmark","Height","Hyperlink","InlineStyle","Name",
"Style","TOC","Width","X","Y"};
static String[] lPropList =
{"Bookmark","Height","Hyperlink","InlineStyle","Name",
"TOC","Width","X","Y"};
static String[] tPropList =
{"Bookmark","Height","Hyperlink","InlineStyle","Name",
"Style","Text","TOC","Width","X","Y"}
static String[] rPropList =
{"TotalPages", "TOCTree", "Name"};
}
Understanding XMLFileWriter
TheXMLFileWriter class writes the closing tag, as shown in Listing 6.
Listing 6: The XMLFileWriter class
package org.eclipse.birt.report.engine.emitter.xml;
import org.eclipse.birt.report.engine.emitter.XMLWriter;
public class XMLFileWriter extends XMLWriter {
public XMLFileWriter( )
{
}
public void writeCode( String code )
{
super.printWriter.print( code );
}
public void startWriter( )
{
}
public void closeTag( String tagName )
{
super.printWriter.print( tagName );
}
}
Understanding XMLRenderOption
The org.eclipse.birt.report.engine.emitter.xml.XMLRenderOption class adds the XML rendering option to the BIRT Report Engine run time, as shown in Listing 7.
Listing 7: The XMLRenderOption class
package org.eclipse.birt.report.engine.emitter.xml;
import org.eclipse.birt.report.engine.api.RenderOption;
public class XMLRenderOption extends RenderOption{
public static final String XML = "XML";
protected String configPath= "";
public XMLRenderOption( ) {
}
public void setExportConfigFile( String config )
{
this.configPath = config;
}
public String getExportConfigFile()
{
return configPath;
}
}
0 Comments (click to add your comment)
Networking Solutions
