Skip to content

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
<XmlDataSource TextFormat="{{Name}}" ValueFormat="{{Id}}" Enabled="True">
    <Mappings/>
    <ItemXPath><![CDATA[Option]]></ItemXPath>
    <Columns/>
    <SourceXPath><![CDATA[/*/Options]]></SourceXPath>
</XmlDataSource>

In this configuration:

  • TextFormat is set to {{Name}}, indicating that the Name element within each item will be used for display text.
  • ValueFormat is set to {{Id}}, specifying that the Id element within each item will be used as the underlying value.
  • Enabled is set to True, activating the data source.
  • Mappings is empty, meaning no additional mappings are specified.
  • ItemXPath is set to <![CDATA[Option]]>, specifying that the Option elements within the XML will be treated as individual items in the result.
  • Columns is empty, meaning no specific columns are being retrieved other than what is defined in the ItemXPath and TextFormat, ValueFormat.
  • SourceXPath is set to <![CDATA[/*/Options]]>, which indicates that the XPath expression /*/Options will be used to locate the XML data source within the current data model. This expression selects the Options element that is a child of the root element (*).