General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
XtraReportBase.XmlDataPath Property
Specifies the path to an XML file that should be used as the report's data source.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v19.2.dll
Declaration
[SRCategory(ReportStringId.CatData)]
[DefaultValue("")]
public virtual string XmlDataPath { get; set; }
<SRCategory(ReportStringId.CatData)>
<DefaultValue("")>
Public Overridable Property XmlDataPath As String
Property Value
Type | Default | Description |
---|---|---|
String | A String value, specifying the full path (including the file name and extension) to the XML file. |
Remarks
This property is retained for backward compatibility and should no longer be used. To learn how to bind a report to XML data, see Binding a Report to XML Data.
You can use the XmlDataPath property to bind a report to an XML file. This approach has the following advantages:
- the file may not include a schema;
- the file may contain complex types.
Consider the following limitations when using this method:
- field types may be interpreted incorrectly; for instance, a numeric field may appear as a character string;
- for security reasons, the v18.1.6+ builds ignore the XmlDataPath property in web applications.
Tip
To use this approach in web applications, set the SecurityLevel property to Unrestricted on application startup.
The following example shows how to bind a report to an XML file with complex type elements.
using DevExpress.XtraReports.UI;
//...
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
XtraReport report = CreateReport();
ReportDesignTool designTool = new ReportDesignTool(report);
designTool.ShowRibbonDesignerDialog();
}
private XtraReport CreateReport()
{
XtraReport report = new XtraReport();
report.XmlDataPath = "ComplexTypes.xml";
return report;
}
}
Imports DevExpress.XtraReports.UI
'...
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim report As XtraReport = CreateReport()
Dim designTool As New ReportDesignTool(report)
designTool.ShowRibbonDesignerDialog()
End Sub
Private Function CreateReport() As XtraReport
Dim report As New XtraReport()
report.XmlDataPath = "ComplexTypes.xml"
Return report
End Function
End Class
<!-- ComplexTypes.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<Report>
<Data>
<Row>
<Id>1</Id>
<Name>Mark</Name>
<Date>10/09/14</Date>
</Row>
<Row>
<Id>2</Id>
<Name>Lisa</Name>
<Date>24/04/11</Date>
</Row>
</Data>
</Report>