Skip to main content

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.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[DefaultValue("")]
[SRCategory(ReportStringId.CatData)]
public virtual string XmlDataPath { get; set; }

Property Value

Type Default Description
String String.Empty

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;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the XmlDataPath property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also