title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | |
---|---|---|---|---|---|---|---|---|---|
Export a paginated report to XML (Report Builder) |
In Report Builder, the XML rendering extension renders a paginated report to XML format. Import XML into a database and use as a message or send to applications. |
maggiesMSFT |
maggies |
09/25/2024 |
reporting-services |
report-builder |
conceptual |
|
[!INCLUDEssrs-appliesto] [!INCLUDE ssrs-appliesto-ssrs-rb] [!INCLUDE ssrs-appliesto-pbi-rb] [!INCLUDE ssrb-applies-to-ssdt-yes]
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
[!INCLUDEssRBRDDup]
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.
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 |
The following sections describe how the XML rendering extensions interpret the items within the report.
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>&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 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 are rendered in XML. The data is structured.
Gauges and indicators are rendered in XML. The data is structured.
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.
A rectangle is rendered as an element. The name of the element is taken from the DataElementName RDL property.
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 aren't rendered.
Lines aren't rendered.
Tables, matrices, and lists, are rendered as an element. The name of the element comes from the Tablix DataElementName
RDL property.
Columns are rendered within rows.
The corner isn't rendered. Only the contents of the corner are rendered.
Tablix cells are rendered as elements. The name of the element is taken from the cell's DataElementName
RDL property.
Tablix automatic subtotals aren't rendered.
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 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.
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.
If there are duplicate data element names within the same scope, the renderer displays an error message.
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.
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.