Export a paginated report to XML (Report Builder)

Applies to: ✅ Microsoft Report Builder (SSRS) ✅ Power BI Report Builder ✅ Report Designer in SQL Server Data Tools

The XML rendering extension returns a paginated report in XML format. The schema for the report XML is specific to the report, and contains data only. The XML rendering extension doesn't render layout information and doesn't maintain pagination. The XML generated by this extension can be imported into a database, used as an XML data message, or sent to a custom application.

Note

You can create and modify paginated report definition (.rdl) files in Microsoft Report Builder, Power BI Report Builder, and in Report Designer in SQL Server Data Tools.

Report Items

The following table describes how report items are rendered.

Item Rendering behavior
Report Renders as the top-level element of the XML document.
Data regions Renders as an element within the element for its container. Data regions include table, matrix, and list that display data as text and chart, data bars, sparklines, gauges, and indicators that visualize data.
Group and detail sections Each instance renders as an element within the element for its container.
Text box Renders as an attribute or element within its container.
Rectangle Renders as an element within its container.
Matrix column groups Renders as elements within row groups.
Map Renders as an element within the element for its container. Map layers are child elements of the map and each map layer includes elements for their map members and map member attributes.
Chart Renders as an element within the element for its container. Series are child elements of the chart, and categories are child element of a series. Renders all chart labels for each chart value. Labels and values are included as attributes.
Data bar Renders as an element within the element for its container, similar to a chart. Typically, a data bar doesn't include hierarchies or labels, only values.
Sparkline Renders as an element within the element for its container, similar to a chart. Typically, a sparkline doesn't include hierarchies or labels, only values.
Gauge Renders as an element within the element for its container. Renders as a single element with the minimum and maximum values of the scale, start and end values of the range, and the value of the pointer as attributes.
Indicator Renders as an element within the element for its container, similar to a gauge. Renders as a single element with the active state name, available states, and the data value as attributes.

Reports that are rendered using the XML rendering extension also follow these rules:

  • XML elements and attributes are rendered in the order that they appear in the report definition.

  • Pagination is ignored.

  • Page headers and footers aren't rendered.

  • Hidden items that can't be made visible by toggling aren't rendered. Initially visible items and hidden items that can be made visible through a toggle are rendered.

  • Images, lines, and custom report items are ignored.

Data types

The text box element or attribute is assigned an XSD data type based on the values that the text box displays.

If all text box values are Assigned data type is
Int16, Int32, Int64, UInt16, UInt32, UInt64, Byte, SByte xsd:integer
Decimal (or Decimal and any integer or byte data type) xsd:decimal
Float (or Decimal and any integer or byte data type) xsd:float
Double (or Decimal and any integer or byte data type) xsd:double
DateTime or DateTime Offset xsd:dateTime
Time xsd:string
Boolean xsd:boolean
String, Char xsd:string
Other xsd:string

XML-Specific rendering rules

The following sections describe how the XML rendering extensions interpret the items within the report.

Report body

A report is rendered as the root element of the XML document. The name of the element comes from the DataElementName property set in the Properties pane.

XML namespace definitions and schema reference attributes are also included in the report element. Variables are noted in <>:

<<Report> xmlns="<SchemaName>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" xsi:<schemaLocation>="<SchemaNameReportURL>&amp;rc%3aSchema=true" Name="ReportName">

The values for the variables are as follows:

Name Value
Report Report.DataElementName
ReportURL URLEncoded absolute URL to the report on the server.
SchemaName Report.SchemaName. If null, then Report.Name. If Report.Name is used, the value is first encoded with XmlConvert.EncodeLocalName.
ReportName The name of the report.

Text boxes

Text boxes are rendered as elements or attributes according to the DataElementStyle RDL property. The name of the element or attribute comes from the TextBox.DataElementName RDL property.

Charts, data bars, and sparklines

Charts, data bars, and sparklines are rendered in XML. The data is structured.

Gauges and indicators

Gauges and indicators are rendered in XML. The data is structured.

Subreports

A subreport is rendered as an element. The name of the element is taken from the DataElementName RDL property. The TextBoxesAsElements property setting of the report overrides that of the subreport. Namespace and XSLT attributes aren't added to the subreport element.

Rectangles

A rectangle is rendered as an element. The name of the element is taken from the DataElementName RDL property.

Custom report items

CustomReportItems (CRI) aren't visible to the rendering extension. If a custom report item exists in the report, the rendering extension renders it as a conventional report item.

Images

Images aren't rendered.

Lines

Lines aren't rendered.

Tables, matrices, and lists

Tables, matrices, and lists, are rendered as an element. The name of the element comes from the Tablix DataElementName RDL property.

Rows and columns

Columns are rendered within rows.

Tablix corner

The corner isn't rendered. Only the contents of the corner are rendered.

Tablix cells

Tablix cells are rendered as elements. The name of the element is taken from the cell's DataElementName RDL property.

Automatic subtotals

Tablix automatic subtotals aren't rendered.

Row and column items that do not repeat with a group

Items that don't repeat with a group, such as labels, subtotals and totals, are rendered as elements. The name of the element comes from the TablixMember.DataElementName RDL property.

The TablixMember.DataElementOutput RDL property controls whether a nonrepeating item is rendered.

If the DataElementName property of the Tablix member isn't provided, a name for the nonrepeating item is dynamically generated in this form:

RowX: For nonrepeating rows, where X is a zero-based row index within the current parent.

ColumnY: For nonrepeating columns, where Y ix a zero-based column index within the current parent.

A nonrepeating header is rendered as a child of the row or column that doesn't repeat with a group.

If a nonrepeating member has no corresponding Tablix cells, it isn't rendered. This result might occur if a Tablix cell where it spans more than one column.

Rows and columns that repeat with a group

Rows and columns that repeat within a group are rendered according to Tablix.DataElementOutput rules. The name for the element is taken from the DataElementName property.

Each unique value within a group is rendered as a child element of the group. The name for the element is taken from the Group.DataElementName property.

If the DataElementOutput property value equals Output, a repeating item's header is rendered as a child of the detail element.

Custom formats and XSL transformations

XML files produced by the XML rendering extension can be transformed into almost any format using XSL Transformations (XSLT). This functionality can be used to produce data in formats not already supported by existing rendering extensions. Consider using the XML rendering extension and XSLT before attempting to create your own rendering extension.

Duplicate names

If there are duplicate data element names within the same scope, the renderer displays an error message.

XSLT transformations

The XML renderer can apply a server-side XSLT transformation to the original XML data. When an XSLT is applied, the renderer outputs the transformed content instead of the original XML data. The transformation occurs on the server, not on the client.

The XSLT to apply to the output is defined either in the report definition file with the DataTransform property of the report. Alternatively, it can be specified with the XSLT DeviceInfo parameter.

If either of these values are set, the transform occurs each time the XML renderer is used. When you use subscriptions, the XSLT must be defined in the RDL DataTransform property.

If an XSLT file is specified, by both the DataTransform definition property and the device information setting, the XSLT specified in DataTransform occurs first, followed by the XSLT set by the device information settings.

Device Information Settings

You can change some default settings for this renderer by changing the device information settings, including the following settings:

  • A transformation (XSLT) to apply to the XML.

  • The MIME type of the XML document.

  • Whether to apply format strings to data.

  • Whether to indent the XML output.

  • Whether to include the XML schema name.

  • The encoding for the XML document.

  • The file extension of the XML document.

For more information, see XML device information settings.