Skip to main content

XML Datasets


There are two approaches you can use to pass a dataset to the engine. Both of these approaches use the call DataSourceProvider.setDatasets() to assign datasets to the data source.

  • The first approach is to create the Dom4jDataset objects in code. This class is documented in the Java Engine API. Create the dataset(s) and pass that array to the data source before processing that data source.
  • The second approach is to create a POD file and pass that POD file to the data source. This enables you to design datasets in AutoTag and use those datasets. This approach is recommended and is detailed below.


Passing datasets to the engine via Pods is composed of two steps:

  1. Create a Pod (.rdlx) file in AutoTag for the datasets. You do this by first defining the datasets in AutoTag and then creating a data source POD of your data source with the datasets in it. Note: You can create the RDLX file in any XML editor, but using AutoTag is the fastest and easiest approach.
  2. When you run the engine, you load up the datasets in the RDLX file and pass the datasets to the data source.

We will cover step 2 here (go to the AutoTag Datasets page for step 1). First create the Dom4jDataSource object for the data source you are going to apply to the report.

Next you call DatasetBase.readPod() passing it a stream to the RDLX file and the name of the data source (not dataset) who's datasets you want it to read. Normally the name you pass here and the name of your data source will be the same - but there is no requirement that they match.

You then pass the returned Dom4jDataset[] to Dom4jDataSource.setDatasets(). When you assign to Datasets, it will discard any previously set datasets.

Now call Report.processData() with your data source.

FileInputStream xml = new FileInputStream(xmlFilename);
Dom4jDataSource dds = new Dom4jDataSource(xml);
FileInputStream fs = new FileInputStream(podFilename);
dds.setDatasets((Dom4jDataset[]) DatasetBase.readPod(fs, datasourceName);
report.ProcessData(dds, datasourceName);

  • Was this article helpful?