XML Data Source¶
This data source executes an XPath expression on the current data model and returns the result as a list of values.
The XPath expression to be evaluated is defined within the SourceXPath element, while the ItemXPath element designates the path to the items within the XML data that will be returned as the result of the query.
The SourceXPath property supports the data templates format, enabling the data source to adapt to a varying data model.
Example¶
In summary, this data source will locate the Options element within the current data model based on the SourceXPath. It will then treat each Option element within that Options element as an individual item and use the Name and Id elements within these Option elements to generate the text and value for the list.
1 2 3 4 5 6 | |
In this configuration:
TextFormatis set to{{Name}}, indicating that theNameelement within each item will be used for display text.ValueFormatis set to{{Id}}, specifying that theIdelement within each item will be used as the underlying value.Enabledis set toTrue, activating the data source.Mappingsis empty, meaning no additional mappings are specified.ItemXPathis set to<![CDATA[Option]]>, specifying that theOptionelements within the XML will be treated as individual items in the result.Columnsis empty, meaning no specific columns are being retrieved other than what is defined in theItemXPathandTextFormat,ValueFormat.SourceXPathis set to<![CDATA[/*/Options]]>, which indicates that the XPath expression/*/Optionswill be used to locate the XML data source within the current data model. This expression selects theOptionselement that is a child of the root element (*).