Delen via


Exporting to XML (Report Builder 3.0 and SSRS)

The XML rendering extension returns a report in XML format. The schema for the report XML is specific to the report, and contains data only. Layout information is not rendered and pagination is not maintained by the XML rendering extension. 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 report definitions (.rdl) in Report Builder 3.0 and in Report Designer in Business Intelligence Development Studio. Each authoring environment provides different ways to create, open, and save reports and related items. For more information, see Designing Reports in Report Designer and Report Builder 3.0 (SSRS) on the Web at microsoft.com.

In This Article

Report Items

Data Types

XML-Specific Rendering Rules

Custom Formats and XSL Transformations

Duplicate Names

XSLT Transformations

Device Information Settings

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 does not include hierarchies or labels, only values.

Sparkline

Renders as an element within the element for its container, similar to a chart. Typically, a sparkline does not 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 are not rendered.

  • Hidden items that cannot be made visible by toggling are not 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.

Arrow icon used with Back to Top linkBack to Top

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

Arrow icon used with Back to Top linkBack to Top

XML-Specific Rendering Rules

The following sections describe how the XML rendering extensions interprets 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 bold face type:

<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, it 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 are not 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) are not 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 are not rendered.

Lines

Lines are not rendered.

Arrow icon used with Back to Top linkBack to Top

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 is not 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 are not rendered.

Row and Column Items that Do Not Repeat with a Group

Items that do not 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 non-repeating item is rendered.

If the DataElementName property of the Tablix member is not provided, a name for the non-repeating item is dynamically generated in this form:

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

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

A non-repeating header is rendered as a child of the row or column that does not repeat with a group.

If a non-repeating member has no corresponding Tablix cells, it is not rendered. This may occur in the case of 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.

Arrow icon used with Back to Top linkBack to Top

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.

Arrow icon used with Back to Top linkBack to Top

Duplicate Names

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

Arrow icon used with Back to Top linkBack to Top

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 or with the XSLT DeviceInfo parameter. If either of these values are set, the transform occurs each time the XML renderer is used. When using 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.

Arrow icon used with Back to Top linkBack to Top

Device Information Settings

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

  • 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.

Arrow icon used with Back to Top linkBack to Top