[]
The XML sample displays customer order list using the XML data source. The sample demonstrates how to create a report with XML data, using a SubReport or using the XML hierarchical structure.
Sample Location
Visual Basic.NET
https://github.com/activereports/Samples19/tree/main/DataBinding/Section/XML/VB.NET
C#
https://github.com/activereports/Samples19/tree/main/DataBinding/Section/XML/C#
Run-Time Features
When you run the sample, you will be asked to select between the following.
Run Customers XML Report
Demonstrates a two level Master/Detail XML Data Source. Uses a SubReport to print the orders of each customer. By selecting any of the radio buttons - Show All Data, Show Report where ID = 2301, or Show All Data with an E-Mail address, you can change the creation option of the generated report.
Customer Orders (Leveled)
Displays customer's orders by using the XML hierarchical structure. The Master/Detail is implemented using the XML hierarchy XPath selection patterns without any SubReports.
Project Details
StartForm
This is the main form of the sample. You see this form after you run the project and where you can select how to display XML data.
Run Customers XML Report
Displays the customers order list by using SubReports.To bind the CustomersOrders report to the XML data source, the valid XPath expression is entered in the RecordsetPattern field on the XML tab of the Report Data Source dialog.
Customer Orders (Leveled)
Displays customer's orders by using the XML hierarchical structure, which is demonstrated by the OrdersLeveled report. To bind this report to XML data, the path to the XML file is entered in the File URL field on the XML tab of the Report Data Source dialog and also the XML hierarchical structure like "../../@email" is specified in each field.
CustomersOrders report
This report embeds the srptOrders SubReport. Following settings are performed in this report.
OrderItems SubReport
This report binds to the Subreport control of Orders report.
Orders SubReport
This is the report with a SubReport control that is bound to the OrderItems report. Following settings are performed in this report.
OrdersLeveled report
Displays the list of customer's orders. Following settings are performed in this report.
ViewerForm
The Viewer control has its Dock property set to Fill. This ensures that the viewer resizes along with the form at run time. Right-click the form and select View Code to see the code used to run the report and display it in the viewer.