Understanding the XML data extraction extension
The XML data extraction extension example described in this section illustrates how to create a plug-in extension that converts all or part of report data to XML format. The XML data extraction extension example exports only the data selected in the export data menu to an output file. The export data feature is available in the BIRT Web Viewer.
This extension example creates the XML output stream and sends the stream to the browser. Most modern browsers show the formatted XML directly. Some may show a download message that prompts the user to select to view or save the XML output.
This behavior depends on the browser and how it is configured to work with XML MIME type files. If the user changes the MIME type in the plug-in’s extension properties to text/plain, the browser displays the XML file instead of displaying a download message.
The following section provides a general description of the code a developer must write to complete the development of an XML data extraction extension.
Implementing the data extraction interfaces
The org.eclipse.birt.report.engine.api and org.eclipse.birt.report.engine.dataextraction plug-ins define the data extraction interfaces used to extract and format data to a specified format. The XML data extraction extension implements the following interfaces and classes:

org.eclipse.birt.report.engine.extension.IDataExtractionExtension
Defines three methods to initialize the resources, output extracted data, and release allocated resources during the data extraction process.
The purpose of the output method is to process the metadata in the result set and format the output in the desired format. Extending the implementation class of the interface DataExtractionExtensionBase instead of the interface itself is a recommended best practice.

org.eclipse.birt.report.engine.api.IExtractionResults
Provides the API for retrieving metadata for the result set.

org.eclipse.birt.report.engine.api.IDataExtractionOption
Defines the basic properties of the data extraction and related get and set methods. Basic properties include elements such as output format, output file, and output stream.

org.eclipse.birt.report.engine.dataextraction.ICommonDataExtractionOption
Extends the IDataExtractionOption interface to define the basic properties and related get and set methods for a common data extraction plug-in. The XML data extraction extension uses this interface, since most of the properties defined for the common data extraction apply to the XML extraction as well.
The implementation class for this interface is org.eclipse.birt.report.engine
.dataextraction.impl.CommonDataExtractionImpl. The class provides utility methods that are initialized according to the data extraction options. The basic properties for the data extraction option are:

Output locale

Output time zone

Output encoding, such as UTF-8, UTF-16LE, or ISO-8859-1

Output date format

Selected columns for export

Indicator of whether to export the columns data type

Indicator of whether to export the locale neutral format value

User-defined parameters