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 XmlDataSourceImpl.Datasets to assign datasets to the data source.

  • The first approach is to create the XPathDataset objects in code. This class is documented in the .NET 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 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 XPathDataSourceImpl object for the data source you are going to apply to the report.

Next you call DatasetFactory.ReadPod() passing it a stream to the RDLX file and the name of the data source (not dataset) who's dataset(s) you want it to read (all datasets for that data source will be loaded). 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 XPathDataset[] to XmlDataSourceImpl.Datasets. When you assign to Datasets, it will discard any previously set datasets.

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

using (FileStreamxmlFile = new FileStream("SouthWind.xml", FileMode.Open, FileAccess.Read, FileShare.Read))
    using (FileStream xmlSchema = new FileStream("SouthWind.xsd", FileMode.Open, FileAccess.Read, FileShare.Read))
        using (XmlDataSourceImpl xmlDatasource = new XmlDataSourceImpl(xmlFile, xmlSchema, true))
            using (FileStream podFile = new FileStream("Sample Datasets.rdlx", FileMode.Open, FileAccess.Read, FileShare.Read)) 
                XPathDataset[] datasets = (XPathDataset[])DatasetFactory.ReadPod(podFile, "SW"); 
                ​xmlDatasource.Datasets = datasets; myReport.ProcessData(xmlDatasource, "SW");
  • Was this article helpful?