XML Query Data Source¶
This data source executes an XQuery expression on an XML database and returns the result as a list of values.
Due to the flexibility of XQuery, this data source can be utilized to query and transform XML data in a multitude of ways.
Query parameters can be specified using the Parameter
elements, and the query itself is defined within the Query
element.
The ItemXPath
element designates the path to the items within the XML data that will be returned as the result of the query.
Example¶
The following example demonstrates a straightforward query that retrieves contacts from an XML database. The query filters the contacts based on a search name and relation type and returns the contacts sorted by display name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
In this configuration:
TextFormat
is set to{{DisplayName}}
, indicating that theDisplayName
element within the XML result will be used for display text.ValueFormat
is set to{{Id}}
, specifying that theId
element will be used as the underlying value.Enabled
is set toTrue
, activating the data source.Mappings
is empty, meaning no additional mappings are specified.ItemXPath
is set to<![CDATA[Contract]]>
, indicating the path to the elements that will be processed as items.- The
Parameters
element defines two parameters:filter
, which is mapped to theFilter/SearchName
element in the data model.typeId
, which is mapped to theFilter/RelationType/Id
element in the data model.
- The
Query
element contains the XQuery expression which:- Iterates over all
Contact
elements. - Filters contacts based on the
filter
andtypeId
parameters, using a case-insensitive search on theSearchName
element. - Orders the results by the
DisplayName
element. - Returns each matching
Contact
element.
- Iterates over all